1
1
package org .bukkit .event ;
2
2
3
+ import org .bukkit .Bukkit ;
3
4
import org .bukkit .plugin .Plugin ;
4
5
import org .bukkit .plugin .PluginManager ;
5
6
import org .jetbrains .annotations .NotNull ;
6
7
7
8
/**
8
9
* Represents an event.
9
- *
10
+ * <br>
10
11
* All events require a static method named getHandlerList() which returns the same {@link HandlerList} as {@link #getHandlers()}.
11
12
*
12
13
* @see PluginManager#callEvent(Event)
13
14
* @see PluginManager#registerEvents(Listener,Plugin)
14
15
*/
15
16
public abstract class Event {
17
+
16
18
private String name ;
17
- private final boolean async ;
19
+ private final boolean isAsync ;
18
20
19
21
/**
20
22
* The default constructor is defined for cleaner code. This constructor
@@ -28,28 +30,26 @@ public Event() {
28
30
* This constructor is used to explicitly declare an event as synchronous
29
31
* or asynchronous.
30
32
*
31
- * @param isAsync true indicates the event will fire asynchronously, false
33
+ * @param isAsync {@code true} indicates the event will fire asynchronously, {@code false}
32
34
* by default from default constructor
33
35
*/
34
36
public Event (boolean isAsync ) {
35
- this .async = isAsync ;
37
+ this .isAsync = isAsync ;
36
38
}
37
39
38
- // Paper start
39
40
/**
40
41
* Calls the event and tests if cancelled.
41
42
*
42
- * @return false if event was cancelled, if cancellable. otherwise true.
43
+ * @return {@code false} if event was cancelled, if cancellable. otherwise {@code true} .
43
44
*/
44
45
public boolean callEvent () {
45
- org . bukkit . Bukkit .getPluginManager ().callEvent (this );
46
+ Bukkit .getPluginManager ().callEvent (this );
46
47
if (this instanceof Cancellable ) {
47
48
return !((Cancellable ) this ).isCancelled ();
48
49
} else {
49
50
return true ;
50
51
}
51
52
}
52
- // Paper end
53
53
54
54
/**
55
55
* Convenience method for providing a user-friendly identifier. By
@@ -60,23 +60,23 @@ public boolean callEvent() {
60
60
*/
61
61
@ NotNull
62
62
public String getEventName () {
63
- if (name == null ) {
64
- name = getClass ().getSimpleName ();
63
+ if (this . name == null ) {
64
+ this . name = this . getClass ().getSimpleName ();
65
65
}
66
- return name ;
66
+ return this . name ;
67
67
}
68
68
69
69
@ NotNull
70
70
public abstract HandlerList getHandlers ();
71
71
72
72
/**
73
- * Any custom event that should not by synchronized with other events must
73
+ * Any custom event that should not be synchronized with other events must
74
74
* use the specific constructor. These are the caveats of using an
75
75
* asynchronous event:
76
76
* <ul>
77
77
* <li>The event is never fired from inside code triggered by a
78
78
* synchronous event. Attempting to do so results in an {@link
79
- * java.lang. IllegalStateException}.
79
+ * IllegalStateException}.
80
80
* <li>However, asynchronous event handlers may fire synchronous or
81
81
* asynchronous events
82
82
* <li>The event may be fired multiple times simultaneously and in any
@@ -89,10 +89,10 @@ public String getEventName() {
89
89
* <li>Asynchronous calls are not calculated in the plugin timing system.
90
90
* </ul>
91
91
*
92
- * @return false by default, true if the event fires asynchronously
92
+ * @return {@code false} by default, {@code true} if the event fires asynchronously
93
93
*/
94
94
public final boolean isAsynchronous () {
95
- return async ;
95
+ return this . isAsync ;
96
96
}
97
97
98
98
public enum Result {
@@ -113,6 +113,6 @@ public enum Result {
113
113
* take place if possible, even if the server would not normally allow
114
114
* the action. Some actions may not be allowed.
115
115
*/
116
- ALLOW ;
116
+ ALLOW
117
117
}
118
118
}
0 commit comments