From 82e93b6359f548d7feaf2146c3c6c6c01b688eaa Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 8 Mar 2023 01:30:26 +0100 Subject: fix: re-enable saving state --- src/main/java/ftbsc/bscv/api/IModule.java | 2 +- src/main/java/ftbsc/bscv/modules/AbstractModule.java | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/ftbsc/bscv/api/IModule.java b/src/main/java/ftbsc/bscv/api/IModule.java index d295023..2b0ea12 100644 --- a/src/main/java/ftbsc/bscv/api/IModule.java +++ b/src/main/java/ftbsc/bscv/api/IModule.java @@ -9,7 +9,7 @@ public interface IModule extends ICommand { ForgeConfigSpec.Builder getConfigBuilder(); default void toggle() { - if(this.isEnabled()) + if (this.isEnabled()) this.disable(); else this.enable(); } diff --git a/src/main/java/ftbsc/bscv/modules/AbstractModule.java b/src/main/java/ftbsc/bscv/modules/AbstractModule.java index fcf4363..384d593 100644 --- a/src/main/java/ftbsc/bscv/modules/AbstractModule.java +++ b/src/main/java/ftbsc/bscv/modules/AbstractModule.java @@ -73,15 +73,10 @@ public abstract class AbstractModule implements IModule { protected void onEnabled() {} protected void onDisabled() {} - public final void toggle() { - if (this.enabled.get()) this.disable(); - else this.enable(); - } - public final void enable() { MinecraftForge.EVENT_BUS.register(this); this.enabled.set(true); - // this.enabled.save(); + this.enabled.save(); this.onEnabled(); log(String.format("%s ON", this.getName())); } @@ -89,7 +84,7 @@ public abstract class AbstractModule implements IModule { public final void disable() { MinecraftForge.EVENT_BUS.unregister(this); this.enabled.set(false); - // this.enabled.save(); + this.enabled.save(); this.onDisabled(); log(String.format("%s OFF", this.getName())); } -- cgit v1.2.3-56-ga3b1