Waterfall/BungeeCord-Patches/0027-Add-callEvent-shortcut-to-Event.patch
Shane Freeder 337ca7f887
Updated Upstream (BungeeCord)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

BungeeCord Changes:
70038c91 Revert "#2714: Remove unnecessary throws in ServerConnector"
39ef20b2 #2716: Don't attempt to send kick packet during handshake phase
74a6aa32 #2714: Remove unnecessary throws in ServerConnector
c7984070 Misc dependency update
2019-12-05 11:53:03 +00:00

33 lines
1.1 KiB
Diff

From 7742a95b8a8db9a8be6e6abd6c4c89e39f6e970e Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Sun, 14 Apr 2019 19:15:00 +0300
Subject: [PATCH] Add callEvent() shortcut to Event
diff --git a/api/src/main/java/net/md_5/bungee/api/plugin/Event.java b/api/src/main/java/net/md_5/bungee/api/plugin/Event.java
index e2e01ecb..25ec1bd8 100644
--- a/api/src/main/java/net/md_5/bungee/api/plugin/Event.java
+++ b/api/src/main/java/net/md_5/bungee/api/plugin/Event.java
@@ -12,4 +12,18 @@ public abstract class Event
public void postCall()
{
}
+ // Waterfall start - Add callEvent() shortcut, borrowed from PaperMC/Paper
+ /**
+ * Calls the event and tests if cancelled.
+ *
+ * @return false if event was cancelled, if cancellable. otherwise true.
+ */
+ public final boolean callEvent() {
+ net.md_5.bungee.api.ProxyServer.getInstance().getPluginManager().callEvent(this);
+ if (this instanceof Cancellable) {
+ return !((Cancellable) this).isCancelled();
+ }
+ return true;
+ }
+ // Waterfall end
}
--
2.24.0