fix: re-enable saving state

This commit is contained in:
əlemi 2023-03-08 01:30:26 +01:00
parent e42f5245db
commit 82e93b6359
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 3 additions and 8 deletions

View file

@ -9,7 +9,7 @@ public interface IModule extends ICommand {
ForgeConfigSpec.Builder getConfigBuilder(); ForgeConfigSpec.Builder getConfigBuilder();
default void toggle() { default void toggle() {
if(this.isEnabled()) if (this.isEnabled())
this.disable(); this.disable();
else this.enable(); else this.enable();
} }

View file

@ -73,15 +73,10 @@ public abstract class AbstractModule implements IModule {
protected void onEnabled() {} protected void onEnabled() {}
protected void onDisabled() {} protected void onDisabled() {}
public final void toggle() {
if (this.enabled.get()) this.disable();
else this.enable();
}
public final void enable() { public final void enable() {
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
this.enabled.set(true); this.enabled.set(true);
// this.enabled.save(); this.enabled.save();
this.onEnabled(); this.onEnabled();
log(String.format("%s ON", this.getName())); log(String.format("%s ON", this.getName()));
} }
@ -89,7 +84,7 @@ public abstract class AbstractModule implements IModule {
public final void disable() { public final void disable() {
MinecraftForge.EVENT_BUS.unregister(this); MinecraftForge.EVENT_BUS.unregister(this);
this.enabled.set(false); this.enabled.set(false);
// this.enabled.save(); this.enabled.save();
this.onDisabled(); this.onDisabled();
log(String.format("%s OFF", this.getName())); log(String.format("%s OFF", this.getName()));
} }