Event.java 630 Bytes
Newer Older
KingRainbow44's avatar
KingRainbow44 committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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.
     */
21
22
23
    public void cancel() {
        if(this instanceof Cancellable)
            this.cancelled = true;
KingRainbow44's avatar
KingRainbow44 committed
24
25
26
27
28
29
30
31
32
    }

    /**
     * Pushes this event to all listeners.
     */
    public void call() {
        Grasscutter.getPluginManager().invokeEvent(this);
    }
}