2022-04-23 05:58:37 +00:00
|
|
|
package emu.grasscutter.server.event;
|
|
|
|
|
|
|
|
import emu.grasscutter.Grasscutter;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A generic server event.
|
|
|
|
*/
|
|
|
|
public abstract class Event {
|
|
|
|
private boolean cancelled = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the cancelled state of the event.
|
|
|
|
*/
|
|
|
|
public boolean isCanceled() {
|
|
|
|
return this.cancelled;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cancels the event if possible.
|
|
|
|
*/
|
2022-04-23 06:08:31 +00:00
|
|
|
public void cancel() {
|
|
|
|
if(this instanceof Cancellable)
|
|
|
|
this.cancelled = true;
|
2022-04-23 05:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pushes this event to all listeners.
|
|
|
|
*/
|
|
|
|
public void call() {
|
|
|
|
Grasscutter.getPluginManager().invokeEvent(this);
|
|
|
|
}
|
|
|
|
}
|