Add a call helper to Event

Reduces diff in Server patches
This commit is contained in:
Aikar 2013-05-19 20:36:58 -04:00
parent ecfabc25c7
commit 7ec6dfa78b

View file

@ -35,6 +35,22 @@ public abstract class Event {
this.async = isAsync;
}
// Paper start
/**
* Calls the event and tests if cancelled.
*
* @return false if event was cancelled, if cancellable. otherwise true.
*/
public boolean callEvent() {
org.bukkit.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()