fix: re-enable saving state
This commit is contained in:
parent
e42f5245db
commit
82e93b6359
2 changed files with 3 additions and 8 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue