mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-21 15:59:21 +00:00
Fixed an error during shutdown
This commit is contained in:
@@ -71,12 +71,15 @@ public final class PlayerLinkHolder {
|
|||||||
private URLClassLoader classLoader;
|
private URLClassLoader classLoader;
|
||||||
private PlayerLink instance;
|
private PlayerLink instance;
|
||||||
|
|
||||||
@NonNull
|
public @NonNull PlayerLink load() {
|
||||||
public PlayerLink load() {
|
|
||||||
if (instance != null) {
|
if (instance != null) {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
instance = load0();
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private @NonNull PlayerLink load0() {
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
throw new IllegalStateException("Config cannot be null!");
|
throw new IllegalStateException("Config cannot be null!");
|
||||||
}
|
}
|
||||||
@@ -189,7 +192,7 @@ public final class PlayerLinkHolder {
|
|||||||
});
|
});
|
||||||
injectorHolder.set(linkInjector);
|
injectorHolder.set(linkInjector);
|
||||||
|
|
||||||
instance = linkInjector.getInstance(mainClass);
|
PlayerLink instance = linkInjector.getInstance(mainClass);
|
||||||
|
|
||||||
// we use our own internal PlayerLinking when global linking is enabled
|
// we use our own internal PlayerLinking when global linking is enabled
|
||||||
if (linkConfig.isEnableGlobalLinking()) {
|
if (linkConfig.isEnableGlobalLinking()) {
|
||||||
@@ -220,6 +223,8 @@ public final class PlayerLinkHolder {
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onShutdown(ShutdownEvent ignored) throws Exception {
|
public void onShutdown(ShutdownEvent ignored) throws Exception {
|
||||||
instance.stop();
|
instance.stop();
|
||||||
|
if (classLoader != null) {
|
||||||
classLoader.close();
|
classLoader.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user