Skip to content

Commit

Permalink
Fix unregistering path executor
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Nov 8, 2024
1 parent 8ddd4b3 commit 4a92ab3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions server/src/main/java/com/soulfiremc/server/api/SoulFireAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,26 @@ public static <E extends SoulFireEvent> void registerListener(Class<E> clazz, Co
EVENT_BUS.registerConsumer(consumer, clazz);
}

public static <E extends SoulFireEvent> void unregisterListener(Class<E> clazz, Consumer<E> consumer) {
EVENT_BUS.unregisterConsumer(consumer, clazz);
}

public static void registerListenersOfClass(Class<?> clazz) {
EVENT_BUS.register(clazz);
}

public static void unregisterListenersOfClass(Class<?> clazz) {
EVENT_BUS.unregister(clazz);
}

public static void registerListenersOfObject(Object object) {
EVENT_BUS.register(object);
}

public static void unregisterListenersOfObject(Object object) {
EVENT_BUS.unregister(object);
}

public static void postEvent(SoulFireEvent event) {
EVENT_BUS.call(event);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public synchronized void unregister() {

registered = false;
connection.controlState().decrementActivelyControlling();
SoulFireAPI.registerListener(BotPreTickEvent.class, this);
SoulFireAPI.unregisterListener(BotPreTickEvent.class, this);
}

public void cancel() {
Expand Down

0 comments on commit 4a92ab3

Please sign in to comment.