Skip to content

Commit

Permalink
Avoid runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Nov 8, 2024
1 parent 818b3e5 commit 5e126f5
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package com.soulfiremc.server.api;

import com.soulfiremc.server.api.event.EventExceptionHandler;
import com.soulfiremc.server.api.event.EventUtil;
import com.soulfiremc.server.api.event.SoulFireEvent;
import com.soulfiremc.server.plugins.*;
import com.soulfiremc.server.util.SFFeatureFlags;
Expand Down Expand Up @@ -95,15 +94,15 @@ public static List<Plugin> getServerExtensions() {
}

public static <E extends SoulFireEvent> void registerListener(Class<E> clazz, Consumer<E> consumer) {
EventUtil.runAndAssertChanged(EVENT_BUS, () -> EVENT_BUS.registerConsumer(consumer, clazz));
EVENT_BUS.registerConsumer(consumer, clazz);
}

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

public static void registerListenersOfObject(Object object) {
EventUtil.runAndAssertChanged(EVENT_BUS, () -> EVENT_BUS.register(object));
EVENT_BUS.register(object);
}

public static void postEvent(SoulFireEvent event) {
Expand Down

0 comments on commit 5e126f5

Please sign in to comment.