diff --git a/src/main/java/emu/grasscutter/server/event/Event.java b/src/main/java/emu/grasscutter/server/event/Event.java index 4392b133b..6e4df304e 100644 --- a/src/main/java/emu/grasscutter/server/event/Event.java +++ b/src/main/java/emu/grasscutter/server/event/Event.java @@ -14,10 +14,12 @@ public abstract class Event { /** Cancels the event if possible. */ public void cancel() { if (this instanceof Cancellable) this.cancelled = true; + else throw new UnsupportedOperationException("Event is not cancellable."); } /** Pushes this event to all listeners. */ public void call() { - Grasscutter.getPluginManager().invokeEvent(this); + var pluginManager = Grasscutter.getPluginManager(); + if (pluginManager != null) pluginManager.invokeEvent(this); } }