mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Allow events to be registered by any class
Supersedes & closes #3073 Co-authored-by: Redned <redned235@gmail.com>
This commit is contained in:
parent
db3b470225
commit
f1da9d7072
25 changed files with 353 additions and 115 deletions
|
@ -72,8 +72,7 @@ public class GeyserSpongePlugin implements GeyserBootstrap {
|
|||
|
||||
private GeyserImpl geyser;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
public void onLoad() {
|
||||
GeyserLocale.init(this);
|
||||
|
||||
if (!configDir.exists())
|
||||
|
@ -114,7 +113,13 @@ public class GeyserSpongePlugin implements GeyserBootstrap {
|
|||
|
||||
this.geyserLogger = new GeyserSpongeLogger(logger, geyserConfig.isDebugMode());
|
||||
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
|
||||
this.geyser = GeyserImpl.start(PlatformType.SPONGE, this);
|
||||
|
||||
this.geyser = GeyserImpl.load(PlatformType.SPONGE, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
GeyserImpl.start();
|
||||
|
||||
if (geyserConfig.isLegacyPingPassthrough()) {
|
||||
this.geyserSpongePingPassthrough = GeyserLegacyPingPassthrough.init(geyser);
|
||||
|
@ -124,6 +129,7 @@ public class GeyserSpongePlugin implements GeyserBootstrap {
|
|||
|
||||
this.geyserCommandManager = new GeyserSpongeCommandManager(Sponge.getCommandManager(), geyser);
|
||||
this.geyserCommandManager.init();
|
||||
|
||||
Sponge.getCommandManager().register(this, new GeyserSpongeCommandExecutor(geyser, geyserCommandManager.getCommands()), "geyser");
|
||||
|
||||
for (Map.Entry<Extension, Map<String, Command>> entry : this.geyserCommandManager.extensionCommands().entrySet()) {
|
||||
|
@ -166,6 +172,11 @@ public class GeyserSpongePlugin implements GeyserBootstrap {
|
|||
return configDir.toPath();
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onServerStarting() {
|
||||
onLoad();
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onServerStart(GameStartedServerEvent event) {
|
||||
onEnable();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue