2020-05-01 22:03:47 +00:00
|
|
|
From edbedec7fd2d9d2b495d81f52c8662429eb2937d Mon Sep 17 00:00:00 2001
|
2016-03-18 04:24:00 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Sun, 19 May 2013 20:36:58 -0400
|
|
|
|
Subject: [PATCH] Add a call helper to Event
|
|
|
|
|
|
|
|
Reduces diff in Server patches
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java
|
2020-04-02 21:07:06 +00:00
|
|
|
index 18d0636b7..8ec56cd6b 100644
|
2016-03-18 04:24:00 +00:00
|
|
|
--- a/src/main/java/org/bukkit/event/Event.java
|
|
|
|
+++ b/src/main/java/org/bukkit/event/Event.java
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -35,6 +35,22 @@ public abstract class Event {
|
2016-03-18 04:24:00 +00:00
|
|
|
this.async = isAsync;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ /**
|
|
|
|
+ * Calls the event and tests if cancelled.
|
|
|
|
+ *
|
2018-06-18 20:42:39 +00:00
|
|
|
+ * @return false if event was cancelled, if cancellable. otherwise true.
|
2016-03-18 04:24:00 +00:00
|
|
|
+ */
|
|
|
|
+ public boolean callEvent() {
|
2019-03-20 00:28:15 +00:00
|
|
|
+ org.bukkit.Bukkit.getPluginManager().callEvent(this);
|
2016-03-18 04:24:00 +00:00
|
|
|
+ if (this instanceof Cancellable) {
|
|
|
|
+ return !((Cancellable) this).isCancelled();
|
|
|
|
+ } else {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Convenience method for providing a user-friendly identifier. By
|
|
|
|
* default, it is the event's class's {@linkplain Class#getSimpleName()
|
|
|
|
--
|
2020-05-01 22:03:47 +00:00
|
|
|
2.26.2
|
2016-03-18 04:24:00 +00:00
|
|
|
|