diff --git a/src/main/java/net/minecraftforge/fml/common/eventhandler/Event.java b/src/main/java/net/minecraftforge/fml/common/eventhandler/Event.java index 41fa28cd01..3f4dddbcf9 100644 --- a/src/main/java/net/minecraftforge/fml/common/eventhandler/Event.java +++ b/src/main/java/net/minecraftforge/fml/common/eventhandler/Event.java @@ -79,8 +79,9 @@ public class Event } /** - * Sets the state of this event, not all events are cancelable, and any attempt to - * cancel a event that can't be will result in a IllegalArgumentException. + * Sets the cancel state of this event. Note, not all events are cancelable, and any attempt to + * invoke this method on an event that is not cancelable (as determined by {@link #isCancelable} + * will result in an {@link UnsupportedOperationException}. * * The functionality of setting the canceled state is defined on a per-event bases. * @@ -90,7 +91,10 @@ public class Event { if (!isCancelable()) { - throw new IllegalArgumentException("Attempted to cancel a non cancellable event"); + throw new UnsupportedOperationException( + "Attempted to call Event#setCanceled() on a non-cancelable event of type: " + + this.getClass().getCanonicalName() + ); } isCanceled = cancel; } @@ -126,6 +130,7 @@ public class Event { result = value; } + /** * Called by the base constructor, this is used by ASM generated * event classes to setup various functionality such as the listener list.