Waterfall/BungeeCord-Patches/0025-Add-callEvent-shortcut-to-Event.patch
_tomcraft 85c0a35f0b
Updated Upstream (BungeeCord) (#695)
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:
6613aaea Add test fix for library classes being visible to non-dependent plugins
53ce6b93 #3200: Fix protocol for 21w40a
d8e29384 #2466: Use switch in "BungeeCord" plugin message handling
5cf869df #3198: Remove terminally deprecated SecurityManager
f26f7d88 Add optional 1.18 (21w40a) snapshot protocol support
2021-10-09 10:43:12 +01:00

33 lines
1.1 KiB
Diff

From fac41e3a38b4f6285700c2527da3e9bbbdb5087e 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.30.1 (Apple Git-130)