summaryrefslogtreecommitdiff
path: root/src/main/java/co
diff options
context:
space:
mode:
author alemidev <me@alemi.dev>2023-01-29 00:03:15 +0100
committer alemidev <me@alemi.dev>2023-01-29 00:03:15 +0100
commit27c30423de8b564539ac43a5fbea97de6ed2e4f8 (patch)
treee9fde297c4fa61c53610a813e6e6f5066884e995 /src/main/java/co
parent6a9df35f400eb1e31c574d1418b0772246b5870f (diff)
feat: added onEnabled/onDisabled callbacks
Diffstat (limited to 'src/main/java/co')
-rw-r--r--src/main/java/co/fantabos/bscv/Module.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/co/fantabos/bscv/Module.java b/src/main/java/co/fantabos/bscv/Module.java
index 295d6a8..dad3d56 100644
--- a/src/main/java/co/fantabos/bscv/Module.java
+++ b/src/main/java/co/fantabos/bscv/Module.java
@@ -41,18 +41,23 @@ public abstract class Module {
);
}
- public void toggle() {
+ protected void onEnabled() {}
+ protected void onDisabled() {}
+
+ public final void toggle() {
if (this.enabled.get()) this.disable();
else this.enable();
}
- public void enable() {
+ public final void enable() {
MinecraftForge.EVENT_BUS.register(this);
this.enabled.set(true);
+ this.onEnabled();
}
- public void disable() {
+ public final void disable() {
MinecraftForge.EVENT_BUS.unregister(this);
this.enabled.set(false);
+ this.onDisabled();
}
}