ScriptsLab
WikiDownloadsSourcesSupport
ScriptsLab
DocumentationDownloadsGitHubDiscord

© 2026 ScriptsLab

Back to src/main/java/com/scriptslab/api/event
J

PluginEvent.java

Java · 53 lines · 1.0 KB

src/main/java/com/scriptslab/api/event/PluginEvent.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.scriptslab.api.event;

/**
 * Base interface for all custom plugin events.
 */
public interface PluginEvent {
    
    /**
     * Gets the event name.
     * 
     * @return event name
     */
    default String getEventName() {
        return getClass().getSimpleName();
    }
    
    /**
     * Checks if this event is cancellable.
     * 
     * @return true if cancellable
     */
    default boolean isCancellable() {
        return this instanceof Cancellable;
    }
    
    /**
     * Gets the timestamp when this event was created.
     * 
     * @return timestamp in milliseconds
     */
    long getTimestamp();
    
    /**
     * Interface for cancellable events.
     */
    interface Cancellable {
        
        /**
         * Checks if the event is cancelled.
         * 
         * @return true if cancelled
         */
        boolean isCancelled();
        
        /**
         * Sets the cancelled state.
         * 
         * @param cancelled new state
         */
        void setCancelled(boolean cancelled);
    }
}