Skip to content
This repository was archived by the owner on Feb 19, 2019. It is now read-only.

Commit 6c0a5e5

Browse files
committed
Fix subscription issues caused when toggling state in onEnable
1 parent 34f034e commit 6c0a5e5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/java/clientapi/module/Module.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ public final void setState(boolean state) {
264264

265265
if (this.state = state) {
266266
onEnable();
267-
ClientAPI.EVENT_BUS.subscribe(this);
267+
if (this.state)
268+
ClientAPI.EVENT_BUS.subscribe(this);
268269
} else {
269270
ClientAPI.EVENT_BUS.unsubscribe(this);
270271
onDisable();

src/main/java/clientapi/module/ModuleMode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public final void setState(boolean state) {
5151
if (state) {
5252
if (parent.getState()) {
5353
this.onEnable();
54-
ClientAPI.EVENT_BUS.subscribe(this);
54+
if (this.state)
55+
ClientAPI.EVENT_BUS.subscribe(this);
5556
}
5657
} else {
5758
ClientAPI.EVENT_BUS.unsubscribe(this);

0 commit comments

Comments
 (0)