create
public static FoliaSignals create(Plugin plugin)Creates a bridge with its own signal bus.
me.tamkungz.signals.folia.FoliaSignals
{@link BukkitSignals} for Folia: the same signals, plus listeners that hop to the thread they need.
<p>
On Folia a Bukkit event is fired on the thread of the region that owns it, and a listener may only touch
blocks, chunks and entities of that region. When a listener has to work on something owned by another region
(the world around a location, another player, ...), connect it with {@link #connectRegion},
{@link #connectEntity}, {@link #connectGlobal} or {@link #connectAsync}. Those run the listener inline when
the current thread already is the right one and schedule it otherwise.
<p>
Signals and connections are thread-safe, so plain {@code connect} calls from any region thread are fine.
public final class FoliaSignals implements EventSignalSourcepublic static FoliaSignals create(Plugin plugin)Creates a bridge with its own signal bus.
public static FoliaSignals create(Plugin plugin, SignalBus bus)Creates a bridge on an existing signal bus.
public static FoliaSignals shared()Returns a bridge over the one shared by every plugin through the installed SignalsLib plugin. <p> Events and listeners are shared with {@link BukkitSignals#shared()}; scheduled tasks belong to SignalsLib.
public BukkitSignals bukkit()Returns the Bukkit bridge behind this one.
public SignalBus bus()Returns the signal bus behind this bridge.
public FoliaScheduler scheduler()Returns the scheduler wrapper of this bridge.
@Override public <T extends Event> Signal<T> signal(Class<T> eventType, EventPriority priority, boolean ignoreCancelled)public PlayerSignals players()Returns shortcuts for player events.
public BlockSignals blocks()Returns shortcuts for block events.
public EntitySignals entities()Returns shortcuts for entity events.
public InventorySignals inventories()Returns shortcuts for inventory events.
public <T> Connection connectGlobal(Signal<T> signal, Consumer<T> listener)Connects a listener that runs on the global region thread.
public <T> Connection connectGlobal(ConnectionGroup group, Signal<T> signal, Consumer<T> listener)Connects a listener that runs on the global region thread and tracks it in a group.
public <T> Connection connectAsync(Signal<T> signal, Consumer<T> listener)Connects a listener that always runs on an async thread, never on a region thread.
public <T> Connection connectAsync(ConnectionGroup group, Signal<T> signal, Consumer<T> listener)Connects a listener that always runs on an async thread and tracks it in a group.
public <T> Connection connectRegion( Signal<T> signal, Function<? super T, ? extends Location> locator, Consumer<T> listener )Connects a listener that runs on the thread of the region that owns a location taken from the payload.
public <T> Connection connectRegion( ConnectionGroup group, Signal<T> signal, Function<? super T, ? extends Location> locator, Consumer<T> listener )Connects a listener that runs on the region thread of a location taken from the payload and tracks it in a group.
public <T> Connection connectEntity( Signal<T> signal, Function<? super T, ? extends Entity> locator, Consumer<T> listener )Connects a listener that runs on the thread of the region that owns an entity taken from the payload. <p> If the entity is removed before the listener gets to run, that call is dropped.
public <T> Connection connectEntity( ConnectionGroup group, Signal<T> signal, Function<? super T, ? extends Entity> locator, Consumer<T> listener )Connects a listener that runs on the region thread of an entity taken from the payload and tracks it in a group.