Class EventSignalBuilder<T>

java.lang.Object
me.tamkungz.signals.velocity.event.EventSignalBuilder<T>
Type Parameters:
T - Velocity event type

public final class EventSignalBuilder<T> extends Object
Fluent options (post order) for listening to one Velocity event type.

Pick the order, then either call signal() or connect a listener directly.

  • Constructor Details

  • Method Details

    • order

      public EventSignalBuilder<T> order(com.velocitypowered.api.event.PostOrder order)
      Sets the order the underlying Velocity handler runs in; the default is PostOrder.NORMAL.
      Parameters:
      order - Velocity post order
      Returns:
      this builder
    • first

      public EventSignalBuilder<T> first()
      Same as order(PostOrder.FIRST).
      Returns:
      this builder
    • early

      public EventSignalBuilder<T> early()
      Same as order(PostOrder.EARLY).
      Returns:
      this builder
    • normal

      public EventSignalBuilder<T> normal()
      Same as order(PostOrder.NORMAL).
      Returns:
      this builder
    • late

      public EventSignalBuilder<T> late()
      Same as order(PostOrder.LATE).
      Returns:
      this builder
    • last

      public EventSignalBuilder<T> last()
      Same as order(PostOrder.LAST).
      Returns:
      this builder
    • signal

      public me.tamkungz.signals.Signal<T> signal()
      Returns the signal for the chosen order, registering the Velocity handler on first use.
      Returns:
      the signal for this event type and order
    • connect

      public me.tamkungz.signals.connection.Connection connect(Consumer<T> listener)
      Connects a listener to the signal for the chosen order.
      Parameters:
      listener - listener to call for every event
      Returns:
      the connection for this listener
    • connect

      public me.tamkungz.signals.connection.Connection connect(me.tamkungz.signals.connection.ConnectionGroup group, Consumer<T> listener)
      Connects a listener and tracks it in a group.
      Parameters:
      group - group that will disconnect the listener
      listener - listener to call for every event
      Returns:
      the connection for this listener
    • connectIf

      public me.tamkungz.signals.connection.Connection connectIf(Predicate<T> predicate, Consumer<T> listener)
      Connects a listener that only receives the events a predicate accepts.
      Parameters:
      predicate - decides which events reach the listener
      listener - listener to call for accepted events
      Returns:
      the connection for this listener
    • connectIf

      public me.tamkungz.signals.connection.Connection connectIf(me.tamkungz.signals.connection.ConnectionGroup group, Predicate<T> predicate, Consumer<T> listener)
      Connects a filtered listener and tracks it in a group.
      Parameters:
      group - group that will disconnect the listener
      predicate - decides which events reach the listener
      listener - listener to call for accepted events
      Returns:
      the connection for this listener
    • once

      public me.tamkungz.signals.connection.Connection once(Consumer<T> listener)
      Connects a listener that is disconnected after its first event.
      Parameters:
      listener - listener to call at most once
      Returns:
      the connection for this listener
    • once

      public me.tamkungz.signals.connection.Connection once(me.tamkungz.signals.connection.ConnectionGroup group, Consumer<T> listener)
      Connects a one-shot listener and tracks it in a group.
      Parameters:
      group - group that will disconnect the listener
      listener - listener to call at most once
      Returns:
      the connection for this listener