We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4525935 commit 48e2711Copy full SHA for 48e2711
1 file changed
src/main/java/net/minecraftforge/eventbus/api/Event.java
@@ -73,8 +73,7 @@ public boolean isCanceled() {
73
* @param cancel The new canceled value
74
*/
75
public void setCanceled(boolean cancel) {
76
- if (!isCancelable())
77
- {
+ if (!isCancelable()) {
78
throw new UnsupportedOperationException(
79
"Attempted to call Event#setCanceled() on a non-cancelable event of type: "
80
+ this.getClass().getCanonicalName()
@@ -87,6 +86,13 @@ public void setCanceled(boolean cancel) {
87
86
isCanceled = cancel;
88
}
89
+ /**
90
+ * Equivalent to calling {@link #setCanceled(boolean)} with {@code true}.
91
+ */
92
+ public void cancel() {
93
+ setCanceled(true);
94
+ }
95
+
96
/**
97
* Determines if this event expects a significant result value.
98
*
0 commit comments