3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-17 21:40:08 +01:00
Paper/Spigot-API-Patches/0025-Add-a-call-helper-to-Event.patch
Aikar c2f872aed3 Add Minimal FastUtil int/long collections.
Importing the full library would double the jar size... its way too large.
So lets just import the basic int/long based collections to then use
to improve performance on these kind of collections.
2016-03-30 01:57:56 -04:00

45 Zeilen
1.2 KiB
Diff

From 81c991a2a0e0f1f58a73b49bb276ab52884d433d Mon Sep 17 00:00:00 2001
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
index 6677e1b..eaf6c49 100644
--- a/src/main/java/org/bukkit/event/Event.java
+++ b/src/main/java/org/bukkit/event/Event.java
@@ -1,5 +1,6 @@
package org.bukkit.event;
+import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
/**
@@ -33,6 +34,22 @@ public abstract class Event {
this.async = isAsync;
}
+ // Paper start
+ /**
+ * Calls the event and tests if cancelled.
+ *
+ * @return if event was cancelled, if cancellable. otherwise true.
+ */
+ public boolean callEvent() {
+ Bukkit.getPluginManager().callEvent(this);
+ 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()
--
2.8.0