Record Class ReloadEvent
java.lang.Object
java.lang.Record
net.flectone.pulse.model.event.lifecycle.ReloadEvent
- Record Components:
cancelled- whether a listener vetoed the remaining reload worktype- the phase of the reload cycle that this event representsflectonePulse- the plugin instancereloadException- the failure that occurred, or null if the reload succeeded
- All Implemented Interfaces:
Event
public record ReloadEvent(boolean cancelled, ReloadEvent.Type type, FlectonePulse flectonePulse, @Nullable ReloadException reloadException)
extends Record
implements Event
Fired after a reload finishes, whether or not it succeeded.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the phase of a reload cycle.Nested classes/interfaces inherited from interface Event
Event.Priority -
Constructor Summary
ConstructorsConstructorDescriptionReloadEvent(boolean cancelled, ReloadEvent.Type type, FlectonePulse flectonePulse, @Nullable ReloadException reloadException) Creates an instance of aReloadEventrecord class.ReloadEvent(FlectonePulse flectonePulse, ReloadEvent.Type type) Creates an event that has not been cancelled and represents a successful reload.ReloadEvent(FlectonePulse flectonePulse, ReloadEvent.Type type, ReloadException reloadException) Creates an event that has not been cancelled. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecancelledrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theflectonePulserecord component.final inthashCode()Returns a hash code value for this object.booleanWhether the reload completed without a failure.@Nullable ReloadExceptionReturns the value of thereloadExceptionrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.withCancelled(boolean cancelled) Returns a copy of this event with the cancelled flag set.withFlectonePulse(FlectonePulse flectonePulse) withReloadException(@Nullable ReloadException reloadException) withType(ReloadEvent.Type type)
-
Constructor Details
-
ReloadEvent
public ReloadEvent(FlectonePulse flectonePulse, ReloadEvent.Type type, ReloadException reloadException) Creates an event that has not been cancelled.- Parameters:
flectonePulse- the plugin instancetype- the phase of the reload cycle that this event representsreloadException- the failure that occurred, or null on success
-
ReloadEvent
Creates an event that has not been cancelled and represents a successful reload.- Parameters:
flectonePulse- the plugin instancetype- the phase of the reload cycle that this event represents
-
ReloadEvent
public ReloadEvent(boolean cancelled, ReloadEvent.Type type, FlectonePulse flectonePulse, @Nullable ReloadException reloadException) Creates an instance of aReloadEventrecord class.- Parameters:
cancelled- the value for thecancelledrecord componenttype- the value for thetyperecord componentflectonePulse- the value for theflectonePulserecord componentreloadException- the value for thereloadExceptionrecord component
-
-
Method Details
-
isSuccessful
public boolean isSuccessful()Whether the reload completed without a failure.- Returns:
- true if no exception was recorded
-
withCancelled
Description copied from interface:EventReturns a copy of this event with the cancelled flag set.- Specified by:
withCancelledin interfaceEvent- Parameters:
cancelled- the new cancelled state- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withType
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withFlectonePulse
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withReloadException
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
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. -
cancelled
-
type
-
flectonePulse
Returns the value of theflectonePulserecord component.- Returns:
- the value of the
flectonePulserecord component
-
reloadException
Returns the value of thereloadExceptionrecord component.- Returns:
- the value of the
reloadExceptionrecord component
-