Class BukkitSignals

java.lang.Object
me.tamkungz.signals.bukkit.BukkitSignals
All Implemented Interfaces:
EventSignalSource

public final class BukkitSignals extends Object implements EventSignalSource
Small bridge from Bukkit events to GEB-backed signals.

Common events are grouped by domain: players(), blocks(), entities() and inventories(). Any other event type is available through EventSignalSource.on(Class).

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns shortcuts for block events.
    me.tamkungz.signals.SignalBus
    bus()
    Returns the signal bus behind this bridge.
    create(org.bukkit.plugin.Plugin plugin)
    Creates a bridge with its own signal bus.
    create(org.bukkit.plugin.Plugin plugin, me.tamkungz.signals.SignalBus bus)
    Creates a bridge on an existing signal bus.
    Returns shortcuts for entity events.
    Returns shortcuts for inventory events.
    Returns shortcuts for player events.
    Returns the bridge shared by every plugin through the installed SignalsLib plugin.
    static me.tamkungz.signals.SignalBus
    Returns the signal bus shared by every plugin through the installed SignalsLib plugin.
    <T extends org.bukkit.event.Event>
    me.tamkungz.signals.Signal<T>
    signal(Class<T> eventType, org.bukkit.event.EventPriority priority, boolean ignoreCancelled)
    Returns the signal for an event type with the given options.
    static <T extends org.bukkit.event.Event>
    me.tamkungz.signals.Signal<T>
    standaloneSignal(org.bukkit.plugin.Plugin plugin, Class<T> eventType)
    Creates a private bridge for a single event type at EventPriority.NORMAL and returns its signal.
    static <T extends org.bukkit.event.Event>
    me.tamkungz.signals.Signal<T>
    standaloneSignal(org.bukkit.plugin.Plugin plugin, Class<T> eventType, org.bukkit.event.EventPriority priority, boolean ignoreCancelled)
    Creates a private bridge for a single event type and returns its signal.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface EventSignalSource

    on, signal
  • Method Details

    • create

      public static BukkitSignals create(org.bukkit.plugin.Plugin plugin)
      Creates a bridge with its own signal bus.
      Parameters:
      plugin - plugin that owns the Bukkit listeners
      Returns:
      a new bridge
    • create

      public static BukkitSignals create(org.bukkit.plugin.Plugin plugin, me.tamkungz.signals.SignalBus bus)
      Creates a bridge on an existing signal bus.
      Parameters:
      plugin - plugin that owns the Bukkit listeners
      bus - bus the signals live on
      Returns:
      a new bridge
    • shared

      public static BukkitSignals shared()
      Returns the bridge shared by every plugin through the installed SignalsLib plugin.
      Returns:
      the shared bridge
    • sharedBus

      public static me.tamkungz.signals.SignalBus sharedBus()
      Returns the signal bus shared by every plugin through the installed SignalsLib plugin.
      Returns:
      the shared bus
    • standaloneSignal

      public static <T extends org.bukkit.event.Event> me.tamkungz.signals.Signal<T> standaloneSignal(org.bukkit.plugin.Plugin plugin, Class<T> eventType, org.bukkit.event.EventPriority priority, boolean ignoreCancelled)
      Creates a private bridge for a single event type and returns its signal.
      Type Parameters:
      T - event type
      Parameters:
      plugin - plugin that owns the Bukkit listener
      eventType - Bukkit event type
      priority - priority the Bukkit listener runs at
      ignoreCancelled - whether cancelled events are skipped
      Returns:
      the signal for that event type
    • standaloneSignal

      public static <T extends org.bukkit.event.Event> me.tamkungz.signals.Signal<T> standaloneSignal(org.bukkit.plugin.Plugin plugin, Class<T> eventType)
      Creates a private bridge for a single event type at EventPriority.NORMAL and returns its signal.
      Type Parameters:
      T - event type
      Parameters:
      plugin - plugin that owns the Bukkit listener
      eventType - Bukkit event type
      Returns:
      the signal for that event type
    • bus

      public me.tamkungz.signals.SignalBus bus()
      Returns the signal bus behind this bridge.
      Returns:
      the signal bus
    • signal

      public <T extends org.bukkit.event.Event> me.tamkungz.signals.Signal<T> signal(Class<T> eventType, org.bukkit.event.EventPriority priority, boolean ignoreCancelled)
      Description copied from interface: EventSignalSource
      Returns the signal for an event type with the given options.
      Specified by:
      signal in interface EventSignalSource
      Type Parameters:
      T - event type
      Parameters:
      eventType - Bukkit event type
      priority - priority the underlying Bukkit listener runs at
      ignoreCancelled - whether cancelled events are skipped
      Returns:
      the signal for that combination
    • players

      public PlayerSignals players()
      Returns shortcuts for player events.
      Returns:
      player signals
    • blocks

      public BlockSignals blocks()
      Returns shortcuts for block events.
      Returns:
      block signals
    • entities

      public EntitySignals entities()
      Returns shortcuts for entity events.
      Returns:
      entity signals
    • inventories

      public InventorySignals inventories()
      Returns shortcuts for inventory events.
      Returns:
      inventory signals