Record Class EventPhase
java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcore.api.event.v2.core.EventPhase
- All Implemented Interfaces:
Comparable<EventPhase>
public record EventPhase(@NotNull String name, int order)
extends Record
implements Comparable<EventPhase>
When a listener runs relative to the others of the same event. Listeners run from the lowest
order() to the
highest; listeners in the same phase run in the order they were registered.
The built-in phases leave room between them, so a mod can slot its own in with of(String, int).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EventPhasestatic final EventPhasestatic final EventPhasestatic final EventPhasestatic final EventPhase -
Constructor Summary
ConstructorsConstructorDescriptionEventPhase(@NotNull String name, int order) Creates an instance of aEventPhaserecord class. -
Method Summary
Modifier and TypeMethodDescriptionafter()A phase running just after this one.before()A phase running just before this one.intcompareTo(@NotNull EventPhase other) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotNull Stringname()Returns the value of thenamerecord component.static EventPhaseA custom phase, e.g.intorder()Returns the value of theorderrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
FIRST
-
EARLY
-
DEFAULT
-
LATE
-
LAST
-
-
Constructor Details
-
EventPhase
Creates an instance of aEventPhaserecord class.- Parameters:
name- the value for thenamerecord componentorder- the value for theorderrecord component
-
-
Method Details
-
of
A custom phase, e.g.EventPhase.of("after_defaults", 500). -
before
A phase running just before this one. -
after
A phase running just after this one. -
compareTo
- Specified by:
compareToin interfaceComparable<EventPhase>
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
order
public int order()Returns the value of theorderrecord component.- Returns:
- the value of the
orderrecord component
-