mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Add a call helper to Event
Reduces diff in Server patches
This commit is contained in:
parent
ecfabc25c7
commit
7ec6dfa78b
1 changed files with 16 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue