There was an error while loading. Please reload this page.
Event listeners are annotated with a net.zenoc.gallium.api.annotations.EventListener
net.zenoc.gallium.api.annotations.EventListener
In this example, we will use a ServerStartEvent
The name of the method doesn't matter, as long as the parameters are correct.
package net.zenoc.gallium.test.listeners; import net.zenoc.gallium.api.annotations.EventListener; import net.zenoc.gallium.api.event.player.PlayerJoinEvent; import net.zenoc.gallium.api.logging.LogManager; import org.apache.logging.log4j.Logger; public class TestListener { private static final Logger log = LogManager.getLogger(); @EventListener public void playerJoinEvent(ServerStartEvent event) { log.info("Hello, world"); } }
EventListeners have to be registered in your plugin like so
package net.zenoc.gallium.test; import net.zenoc.gallium.api.annotations.PluginLifecycleListener; import net.zenoc.gallium.plugin.PluginLifecycleState; import net.zenoc.gallium.plugin.java.JavaPlugin; public class GalliumPlugin extends JavaPlugin { @PluginLifecycleListener(PluginLifecycleState.ENABLED) public void onPluginEnable() { Gallium.getEventManager().registerEvent(new TestListener()); } }