fix: ondisable not called properly
This commit is contained in:
4 files changed
+62
-1
No files matched your search
@@ -1,6 +1,9 @@
|
||||
package io.ib67.sfcraft;
|
||||
|
||||
public interface Lifecycle {
|
||||
/**
|
||||
* Invoke at ModInit (registries are open, etc.)
|
||||
*/
|
||||
void onInitialize();
|
||||
|
||||
void onStateChange(State state);
|
||||
|
||||
@@ -70,6 +70,11 @@ public class SFCraftInitializer extends GuiceModInitializer {
|
||||
log.info("Load completed! " + getModuleManager().getModules().size() + " modules were loaded.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStopping(MinecraftServer minecraftServer) {
|
||||
getModuleManager().switchGlobalState(Lifecycle.State.DISABLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Injector onInit() {
|
||||
SFEntityType.registerEntities();
|
||||
|
||||
@@ -23,10 +23,17 @@ public abstract class ServerModule extends AbstractModule implements Lifecycle {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Often called when server is shutting down. Can also be triggered by manual operation
|
||||
*/
|
||||
public void onDisable() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Often called when server is starting. Can also be triggered by manual operation
|
||||
* In this phase you can access MinecraftServer via {@link io.ib67.sfcraft.inject.MinecraftServerSupplier}, which is injectable.
|
||||
*/
|
||||
public void onEnable() {
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user