Git Product home page Git Product logo

bridgeit's Introduction

Bridgeit

Bridgeit is a simple mod that allows for registering of event listeners outside the Forge environment. This mod was made to allow Bukkit plugins run in Forge/Bukkit Hybrid servers (Catserver, Magma, etc) to be able to listen to events from Forge within the plugin.

If you need help or want to keep up with other projects I'm working on, feel free to join the Modworks Discord Server.

Quick Overview

Bridgeit listens for events and checks if an event has ant registered listener's to it which are Consumers. If there's any listeners to a certain event class then on fired it'll execute all the registered consumers. Which solves the issues with Forge not being able to find Bukkit classes or proper mods registering it, etc. Bridgeit supports any event that's called on the MinecraftForge EventBus and extends from Forge's Event class.

Code Example

You can add a new listener by calling addListener on the Bridgeit main instance. Which as arguments you pass in the class of the event you want to listen to and then a consumer, that'll be called for the execution of the event.

In this example we'll be adding a new listener to the ExperienceGainEvent from Pixelmon Generations.

public class ExampleProject extends JavaPlugin implements Listener {
	
	@Override
	public void onEnable()
	{	
		// Registers the listener to the event to Bridgeit	
		Bridgeit.INSTANCE.addListener(ExperienceGainEvent.class, ExampleProject::onExperienceGain);
	}
	
	public static void onExperienceGain(ExperienceGainEvent event)
	{
		// If the Pokemon's species is a Eevee
		if(event.getPokemon().getSpecies() == EnumSpecies.Eevee)
		{
			// Set experience gain to 3000 points
			event.setExperience(3000);
		}
	}
	
}

bridgeit's People

Contributors

deltric avatar

Stargazers

SoraxDubbing avatar REghZy avatar Protoxy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.