Class SignalCondition

java.lang.Object
com.hypixel.hytale.builtin.adventure.worldevents.condition.SignalCondition
All Implemented Interfaces:
EventCondition, EventCondition.Event<WorldEventSignal>

public class SignalCondition extends Object implements EventCondition.Event<WorldEventSignal>
Completes when a WorldEventSignal with a matching id is delivered to the world's ConditionManager. Only listens while its stage is active, so signals sent before the stage is reached are not buffered.
  • Field Details

  • Constructor Details

    • SignalCondition

      public SignalCondition()
  • Method Details

    • test

      public boolean test()
      Description copied from interface: EventCondition
      Returns true when this condition has been satisfied.

      This method is called frequently and must be side-effect free. Update internal state in EventCondition.Ticking.tick(float, Store) or EventCondition.Event.handle(World, T) instead.

      Specified by:
      test in interface EventCondition
      Returns:
      true if the condition is met
    • reset

      public void reset()
      Description copied from interface: EventCondition
      Resets the condition to its unsatisfied state before a new stage iteration begins.

      Called before EventCondition.onStart(WorldEvent) at the start of a stage. All transient fields (timers, flags, cached context references) should be cleared here.

      Specified by:
      reset in interface EventCondition
    • eventType

      @Nonnull public Class<WorldEventSignal> eventType()
      Description copied from interface: EventCondition.Event
      Returns the exact class of the ECS event this condition handles.
      Specified by:
      eventType in interface EventCondition.Event<WorldEventSignal>
      Returns:
      the event class; must match the type parameter T exactly
    • handle

      public void handle(@Nonnull World world, @Nonnull WorldEventSignal event)
      Description copied from interface: EventCondition.Event
      Processes an incoming ECS event and updates internal state.

      This is called for every matching event, not only for events that are relevant to this specific condition instance. Implementations must check (e.g. by comparing UUIDs) whether the event is relevant before updating state.

      Specified by:
      handle in interface EventCondition.Event<WorldEventSignal>
      Parameters:
      world - the world in which the event was fired
      event - the ECS event
    • onStart

      public boolean onStart(@Nonnull WorldEvent event)
      Description copied from interface: EventCondition
      Called when the stage this condition belongs to begins, after EventCondition.reset().

      Implementations typically use this to look up values in the event context that the condition needs in order to operate (e.g. a location or a child event reference). If a required context value is absent, log a warning and return false to abort the stage immediately.

      Specified by:
      onStart in interface EventCondition
      Parameters:
      event - the world event whose stage is starting
      Returns:
      false to abort the stage before it runs