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

Commit a1d69e6

Browse files
committed
Fix ModuleMode binds
1 parent b5641b7 commit a1d69e6

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

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

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package clientapi.module;
1818

19-
import clientapi.ClientAPI;
2019
import clientapi.util.io.Keybind;
2120
import clientapi.value.holder.ValueHolder;
2221

@@ -48,11 +47,6 @@ public class ModuleMode<T extends Module> extends ValueHolder implements IModule
4847
*/
4948
private Keybind bind;
5049

51-
/**
52-
* The state of the mode
53-
*/
54-
private boolean state;
55-
5650
public ModuleMode(T parent, String name, String description) {
5751
this.parent = parent;
5852
this.name = name;
@@ -65,23 +59,10 @@ public ModuleMode(T parent, String name, String description) {
6559
});
6660
}
6761

68-
@Override
69-
public void toggle() {
70-
this.setState(!this.getState());
71-
}
72-
7362
@Override
7463
public void setState(boolean state) {
75-
this.state = state;
76-
if (state) {
77-
if (parent.getState()) {
78-
this.onEnable();
79-
ClientAPI.EVENT_BUS.subscribe(this);
80-
}
81-
} else {
82-
ClientAPI.EVENT_BUS.unsubscribe(this);
83-
this.onDisable();
84-
}
64+
parent.setState(state);
65+
parent.setMode(this);
8566
}
8667

8768
/**
@@ -100,13 +81,13 @@ public final String getName() {
10081
}
10182

10283
@Override
103-
public String getDescription() {
84+
public final String getDescription() {
10485
return this.description;
10586
}
10687

10788
@Override
10889
public final boolean getState() {
109-
return state;
90+
return this.parent.getState() && this.parent.getMode() == this;
11091
}
11192

11293
@Override

0 commit comments

Comments
 (0)