Geyser
Geyser copied to clipboard
Events can be handled by any class
The Extension
class extends EventListener
, and any class can implement it and then register it:
ClassThatImplementsEventListener eventListener = new ClassThatImplementsEventListener();
GeyserApi.api().eventBus().register(eventListener, eventListener);
Also:
- Loggers have the same implementation (
AbstractLogger
) so that we make sure they follow each other - Stopped the
extensions
folder from being created at the server root for non standalone and moved it into the data folder.
I would suggest using the onLoad function for that, but I need to make sure that moving code around like that won’t break anything.
I'm not sure if we need a whole Logger interface - maybe we should just use Java's?
This PR looks fine to me otherwise. But, before we merge, we do need to figure out a good way for, say, Spigot plugins to reliably attach themselves to Geyser before Geyser initializes.
Java's one is full of things that we don't need in Geyser isn't it? I can remove the AbstractLogger
and put it back to the way it was.
I have no idea if this broke anything. This code needs checking by someone who knows Geyser better than me, but I was able to catch the init events by registering my listeners in the onLoad
event of my spigot plugin. If the code is fine, notify me, and I'll make this PR not be a draft anymore if you can't merge.
The only thing I'm wondering is if we should delay plugin loading after onEnable so plugins have a chance to register lifecycle events at any point during initialization.
Do people really want Geyser to be slower? I thought you had been working on trying to make the load time faster.
I think there's a difference here, since we're simply delaying triggering parts of the plugin. It doesn't really matter for us when the load time is. Our only requirement is that Geyser is booted by/around the time the server is ready.
Registering listeners is broken for now but the code for loading in onLoad is fixed.
Superseded by https://github.com/GeyserMC/Geyser/commit/f1da9d70728ad50cbff5c345052f8b18fabb06f2.