public class Event
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Event.HasResult |
static class |
Event.Result |
Modifier and Type | Field and Description |
---|---|
private boolean |
isCanceled |
private static ListenerList |
listeners |
private EventPriority |
phase |
private Event.Result |
result |
Constructor and Description |
---|
Event() |
Modifier and Type | Method and Description |
---|---|
ListenerList |
getListenerList()
Returns a ListenerList object that contains all listeners
that are registered to this event.
|
EventPriority |
getPhase() |
Event.Result |
getResult()
Returns the value set as the result of this event
|
boolean |
hasResult()
Determines if this event expects a significant result value.
|
boolean |
isCancelable()
Determine if this function is cancelable at all.
|
boolean |
isCanceled()
Determine if this event is canceled and should stop executing.
|
void |
setCanceled(boolean cancel)
Sets the cancel state of this event.
|
void |
setPhase(EventPriority value) |
void |
setResult(Event.Result value)
Sets the result value for this event, not all events can have a result set, and any attempt to
set a result for a event that isn't expecting it will result in a IllegalArgumentException.
|
protected void |
setup()
Called by the base constructor, this is used by ASM generated
event classes to setup various functionality such as the listener list.
|
private boolean isCanceled
private Event.Result result
private static ListenerList listeners
private EventPriority phase
public boolean isCancelable()
public boolean isCanceled()
public void setCanceled(boolean cancel)
isCancelable()
will result in an UnsupportedOperationException
.
The functionality of setting the canceled state is defined on a per-event bases.cancel
- The new canceled valuepublic boolean hasResult()
public Event.Result getResult()
public void setResult(Event.Result value)
value
- The new resultprotected void setup()
public ListenerList getListenerList()
@Nullable public EventPriority getPhase()
public void setPhase(@Nonnull EventPriority value)