Package com.prineside.tdi2.events
Class EventListeners.Entry<T extends Event>
java.lang.Object
com.prineside.tdi2.events.EventListeners.Entry<T>
- Type Parameters:
 T- type of an event
- All Implemented Interfaces:
 Pool.Poolable,KryoSerializable
- Enclosing class:
 - EventListeners<T extends Event>
 
public static final class EventListeners.Entry<T extends Event>
extends Object
implements Pool.Poolable, KryoSerializable
Entry inside of an EventListeners, contains some meta data and flags.
 Returned by add...() methods.
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classEventListeners.Entry.EntryMetaData<T extends Event>Extra info about the entry. - 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptiongetName()intbooleanCheck if listener's priority set automatically by the listener groupbooleanCheck if listener will survive the EventListeners#reset()booleanCheck if listener affects game statevoidvoidremove()A convenient way of removing the listener from the group, does exactly the same as EventListeners#remove(listener)voidreset()Allows this entry to be re-used, forced to be public by Poolable interface.setDescription(String description) Allows to describe a listener to make it easier to debug.Gives listener a name, to make it easier to debug events.setPersistent(boolean persistent) Set listener FLAG_PERSISTENT flagMark listener as persistent, similar to adding FLAG_PERSISTENT.toString()void 
- 
Field Details
- 
COMPARATOR
 
 - 
 - 
Constructor Details
- 
Entry
public Entry() 
 - 
 - 
Method Details
- 
write
- Specified by:
 writein interfaceKryoSerializable
 - 
read
- Specified by:
 readin interfaceKryoSerializable
 - 
getMetaData
- Returns:
 - entry meta data
 
 - 
setName
Gives listener a name, to make it easier to debug events. It is advised to set a name manually only when the listener does not-so-obvious job or if there are multiple listeners for the same event in a single class. By default, listener's class name will be used as a name. - 
getName
- Returns:
 - previously set name of the entry or, if not set - just a class name of the listener.
 
 - 
setDescription
Allows to describe a listener to make it easier to debug. Description should be short but meaningful.- Parameters:
 description- tells what the listener does- Returns:
 - this, for chaining
 
 - 
getDescription
- Returns:
 - previously set description or null
 
 - 
getPriority
public int getPriority()- Returns:
 - priority of the entry (set manually or automatically, depending on flags)
 
 - 
getListener
- Returns:
 - an actual instance of the listener
 
 - 
reset
public void reset()Allows this entry to be re-used, forced to be public by Poolable interface. Called by EventListeners at the moment it frees the entry to the pool, should not be called manually.- Specified by:
 resetin interfacePool.Poolable
 - 
remove
public void remove()A convenient way of removing the listener from the group, does exactly the same as EventListeners#remove(listener) - 
isStateAffecting
public boolean isStateAffecting()Check if listener affects game state- Returns:
 - true if listener is state affecting. State affecting listeners are sync checked, serialized and affect the order of other state-affecting listeners (if isAutoPriority())
 
 - 
isAutoPriority
public boolean isAutoPriority()Check if listener's priority set automatically by the listener group- Returns:
 - true if listener's priority has been set automatically
 
 - 
isPersistent
public boolean isPersistent()Check if listener will survive the EventListeners#reset()- Returns:
 - true if FLAG_PERSISTENT is set, which will make it survive EventListeners#reset()
 
 - 
setPersistentToTrue
Mark listener as persistent, similar to adding FLAG_PERSISTENT. Can be called at any time.- Returns:
 - this for chaining
 
 - 
setPersistent
Set listener FLAG_PERSISTENT flag- Parameters:
 persistent- whether FLAG_PERSISTENT should be set- Returns:
 - this for chaining
 
 - 
toString
 
 -