Package kr.toxicity.model.api.util
Class EventUtil
java.lang.Object
kr.toxicity.model.api.util.EventUtil
Utility class for dispatching model events.
This class provides helper methods to call events on the BetterModelEventBus
and handle cancellable events conveniently.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ModelEvent>
BetterModelEventBus.ResultCalls an event on the global event bus.static booleancall(@NotNull ModelEvent event) Calls an event and checks if it was cancelled.
-
Method Details
-
call
@NotNull public static <T extends ModelEvent> BetterModelEventBus.Result call(@NotNull @NotNull Class<T> eventClass, @NotNull @NotNull Supplier<T> eventSupplier) Calls an event on the global event bus.- Type Parameters:
T- the type of the event- Parameters:
eventClass- the class of the eventeventSupplier- a supplier that creates the event- Returns:
- the result of the event call
- Since:
- 2.0.0
-
call
Calls an event and checks if it was cancelled.If the event is cancellable, this method returns true only if the event was NOT cancelled. If the event is not cancellable, it always returns true.
- Parameters:
event- the event to call- Returns:
- true if the event should proceed (not cancelled), false otherwise
- Since:
- 2.0.0
-