public class CustomEvent extends Event
onCustomEvent()
when a custom condition is met. Be sure to reset or remove
the custom condition to avoid having it recurring repeatedly (see the
example for the getCondition()
method.getCondition()
,
Serialized FormConstructor and Description |
---|
CustomEvent(Condition condition)
Called by the game to create a new CustomEvent when a condition is met.
|
CustomEvent(Condition condition,
int priority)
Called by the game to create a new CustomEvent when a condition is met.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Event event)
Compares this event to another event regarding precedence.
|
Condition |
getCondition()
Returns the condition that fired, causing this event to be generated.
|
int |
getPriority()
Returns the priority of this event.
|
getTime, setPriority, setTime
public CustomEvent(Condition condition)
condition
- the condition that must be metpublic CustomEvent(Condition condition, int priority)
Condition.setPriority(int)
on the
Condition.condition
- the condition that must be metpriority
- the priority of the conditionpublic Condition getCondition()
public void onCustomEvent(CustomEvent event) { if (event.getCondition().getName().equals("mycondition")) { removeCustomEvent(event.getCondition()); // do something else } }
public final int compareTo(Event event)
compareTo
in interface Comparable<Event>
compareTo
in class Event
event
- the event to compare to this event.public final int getPriority()
An event priority is a value from 0 - 99. The higher value, the higher priority.
The default priority is 80, but varies depending on the type of event.
getPriority
in class Event
Copyright © 2017. All rights reserved.