Waterfall/BungeeCord-Patches/0026-Add-callEvent-shortcut-to-Event.patch
Shane Freeder 2cab85cbef
Don't intern scoreboard player names
This patch was heavily intented to fix a server side issue which
is generally no longer relevant, not to mention the cost of interning
only cements this patch into it's grave
2020-05-08 19:40:43 +01:00

33 lines
1.1 KiB
Diff

From e86cf467adab61a44534cc9ece28770989a5e1c4 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.26.1