Class EventSignalBuilder<T extends org.bukkit.event.Event>
java.lang.Object
me.tamkungz.signals.bukkit.event.EventSignalBuilder<T>
- Type Parameters:
T- Bukkit event type
-
Constructor Summary
ConstructorsConstructorDescriptionEventSignalBuilder(EventSignalSource source, Class<T> eventType) Creates a builder; preferEventSignalSource.on(Class). -
Method Summary
Modifier and TypeMethodDescriptionme.tamkungz.signals.connection.ConnectionConnects a listener to the signal for the chosen options.me.tamkungz.signals.connection.ConnectionConnects a listener and tracks it in a group.me.tamkungz.signals.connection.ConnectionConnects a listener that only receives the events a predicate accepts.me.tamkungz.signals.connection.ConnectionconnectIf(me.tamkungz.signals.connection.ConnectionGroup group, Predicate<T> predicate, Consumer<T> listener) Connects a filtered listener and tracks it in a group.high()Same aspriority(EventPriority.HIGH).highest()Same aspriority(EventPriority.HIGHEST).Skips events that an earlier listener already cancelled.Delivers cancelled events too; this is the default.low()Same aspriority(EventPriority.LOW).lowest()Same aspriority(EventPriority.LOWEST).monitor()Same aspriority(EventPriority.MONITOR).normal()Same aspriority(EventPriority.NORMAL).me.tamkungz.signals.connection.ConnectionConnects a listener that is disconnected after its first event.me.tamkungz.signals.connection.ConnectionConnects a one-shot listener and tracks it in a group.priority(org.bukkit.event.EventPriority priority) Sets the priority the underlying Bukkit listener runs at; the default isEventPriority.NORMAL.me.tamkungz.signals.Signal<T> signal()Returns the signal for the chosen options, registering the Bukkit listener on first use.
-
Constructor Details
-
EventSignalBuilder
Creates a builder; preferEventSignalSource.on(Class).- Parameters:
source- where the signal comes fromeventType- Bukkit event type
-
-
Method Details
-
priority
Sets the priority the underlying Bukkit listener runs at; the default isEventPriority.NORMAL.- Parameters:
priority- Bukkit event priority- Returns:
- this builder
-
lowest
-
low
-
normal
-
high
-
highest
Same aspriority(EventPriority.HIGHEST).- Returns:
- this builder
-
monitor
Same aspriority(EventPriority.MONITOR). Listeners at this priority must not change the event.- Returns:
- this builder
-
ignoreCancelled
Skips events that an earlier listener already cancelled.- Returns:
- this builder
-
includeCancelled
Delivers cancelled events too; this is the default.- Returns:
- this builder
-
signal
Returns the signal for the chosen options, registering the Bukkit listener on first use.- Returns:
- the signal for this event type, priority and cancellation mode
-
connect
-
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 listenerlistener- 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 listenerlistener- 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 listenerpredicate- decides which events reach the listenerlistener- listener to call for accepted events- Returns:
- the connection for this listener
-
once
-
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 listenerlistener- listener to call at most once- Returns:
- the connection for this listener
-