3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 00:00:41 +01:00

Fix /geyser reload on Velocity (#4258)

* Fix /geyser reload on Velocity 

* No need to create/init a new injector on Velocity

* No need to warn about "abnormally long startup" on Bungee when we're reloading. And, as on velocity, no need to re-inject
Dieser Commit ist enthalten in:
chris 2023-11-03 17:16:09 +01:00 committet von GitHub
Ursprung 4ff8b7bff4
Commit 644082ae84
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 30 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -70,6 +70,8 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
private GeyserImpl geyser;
private static boolean INITIALIZED = false;
@Override
public void onLoad() {
GeyserLocale.init(this);
@ -133,7 +135,12 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
// Big hack - Bungee does not provide us an event to listen to, so schedule a repeating
// task that waits for a field to be filled which is set after the plugin enable
// process is complete
this.awaitStartupCompletion(0);
if (!INITIALIZED) {
this.awaitStartupCompletion(0);
} else {
// No need to "wait" for startup completion, just start Geyser - we're reloading.
this.postStartup();
}
}
@SuppressWarnings("unchecked")
@ -166,8 +173,10 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
private void postStartup() {
GeyserImpl.start();
this.geyserInjector = new GeyserBungeeInjector(this);
this.geyserInjector.initializeLocalChannel(this);
if (!INITIALIZED) {
this.geyserInjector = new GeyserBungeeInjector(this);
this.geyserInjector.initializeLocalChannel(this);
}
this.geyserCommandManager = new GeyserCommandManager(geyser);
this.geyserCommandManager.init();
@ -187,6 +196,8 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
} else {
this.geyserBungeePingPassthrough = new GeyserBungeePingPassthrough(getProxy());
}
INITIALIZED = true;
}
@Override

Datei anzeigen

@ -64,6 +64,11 @@ import java.util.UUID;
@Plugin(id = "geyser", name = GeyserImpl.NAME + "-Velocity", version = GeyserImpl.VERSION, url = "https://geysermc.org", authors = "GeyserMC")
public class GeyserVelocityPlugin implements GeyserBootstrap {
/**
* Determines if the plugin has been ran once before, including before /geyser reload.
*/
private static boolean INITIALIZED = false;
@Inject
private Logger logger;
@ -114,13 +119,20 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
this.geyser = GeyserImpl.load(PlatformType.VELOCITY, this);
// Hack: Normally triggered by ListenerBoundEvent, but that doesn't fire on /geyser reload
if (INITIALIZED) {
this.postStartup();
}
}
private void postStartup() {
GeyserImpl.start();
this.geyserInjector = new GeyserVelocityInjector(proxyServer);
// Will be initialized after the proxy has been bound
if (!INITIALIZED) {
this.geyserInjector = new GeyserVelocityInjector(proxyServer);
// Will be initialized after the proxy has been bound
}
this.geyserCommandManager = new GeyserCommandManager(geyser);
this.geyserCommandManager.init();
@ -195,6 +207,8 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
geyserInjector.initializeLocalChannel(this);
}
}
INITIALIZED = true;
}
@Override