1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2026-01-04 15:31:36 +00:00

Don't attempt to clear registry that hasn't been loaded yet (#5101)

This commit is contained in:
chris
2024-10-25 00:55:19 +08:00
committed by GitHub
parent e7ecb55f33
commit 29fe033257
2 changed files with 10 additions and 1 deletions

View File

@@ -723,7 +723,9 @@ public class GeyserImpl implements GeyserApi, EventRegistrar {
runIfNonNull(newsHandler, NewsHandler::shutdown);
runIfNonNull(erosionUnixListener, UnixSocketClientListener::close);
Registries.RESOURCE_PACKS.get().clear();
if (Registries.RESOURCE_PACKS.loaded()) {
Registries.RESOURCE_PACKS.get().clear();
}
this.setEnabled(false);
}

View File

@@ -112,6 +112,13 @@ public final class DeferredRegistry<M> implements IRegistry<M> {
this.loaded = true;
}
/**
* Whether this registry was loaded.
*/
public boolean loaded() {
return this.loaded;
}
/**
* Creates a new deferred registry.
*