Class VelocitySignals

java.lang.Object
me.tamkungz.signals.velocity.VelocitySignals
All Implemented Interfaces:
EventSignalSource

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

Common events are grouped by domain: players(), servers() and proxy(). Any other Velocity event type is available through EventSignalSource.on(Class).

Velocity runs handlers on its own thread pools, so listeners connected here may be called from any thread.

  • Method Summary

    Modifier and Type
    Method
    Description
    me.tamkungz.signals.SignalBus
    bus()
    Returns the signal bus behind this bridge.
    create(Object plugin, com.velocitypowered.api.proxy.ProxyServer server)
    Creates a bridge with its own signal bus.
    create(Object plugin, com.velocitypowered.api.proxy.ProxyServer server, me.tamkungz.signals.SignalBus bus)
    Creates a bridge on an existing signal bus.
    Returns shortcuts for player events.
    Returns shortcuts for proxy events.
    Returns shortcuts for backend server 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> me.tamkungz.signals.Signal<T>
    signal(Class<T> eventType, com.velocitypowered.api.event.PostOrder order)
    Returns the signal for an event type with the given post order.
    static <T> me.tamkungz.signals.Signal<T>
    standaloneSignal(Object plugin, com.velocitypowered.api.proxy.ProxyServer server, Class<T> eventType)
    Creates a private bridge for a single event type at PostOrder.NORMAL and returns its signal.
    static <T> me.tamkungz.signals.Signal<T>
    standaloneSignal(Object plugin, com.velocitypowered.api.proxy.ProxyServer server, Class<T> eventType, com.velocitypowered.api.event.PostOrder order)
    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 VelocitySignals create(Object plugin, com.velocitypowered.api.proxy.ProxyServer server)
      Creates a bridge with its own signal bus.

      Velocity handlers are registered lazily, the first time a signal is requested, so the plugin must be loaded by then (for example from ProxyInitializeEvent on).

      Parameters:
      plugin - plugin instance that owns the Velocity handlers
      server - the proxy
      Returns:
      a new bridge
    • create

      public static VelocitySignals create(Object plugin, com.velocitypowered.api.proxy.ProxyServer server, me.tamkungz.signals.SignalBus bus)
      Creates a bridge on an existing signal bus.
      Parameters:
      plugin - plugin instance that owns the Velocity handlers
      server - the proxy
      bus - bus the signals live on
      Returns:
      a new bridge
    • shared

      public static VelocitySignals 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> me.tamkungz.signals.Signal<T> standaloneSignal(Object plugin, com.velocitypowered.api.proxy.ProxyServer server, Class<T> eventType, com.velocitypowered.api.event.PostOrder order)
      Creates a private bridge for a single event type and returns its signal.
      Type Parameters:
      T - event type
      Parameters:
      plugin - plugin instance that owns the Velocity handler
      server - the proxy
      eventType - Velocity event type
      order - order in which the Velocity handler runs
      Returns:
      the signal for that event type
    • standaloneSignal

      public static <T> me.tamkungz.signals.Signal<T> standaloneSignal(Object plugin, com.velocitypowered.api.proxy.ProxyServer server, Class<T> eventType)
      Creates a private bridge for a single event type at PostOrder.NORMAL and returns its signal.
      Type Parameters:
      T - event type
      Parameters:
      plugin - plugin instance that owns the Velocity handler
      server - the proxy
      eventType - Velocity 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> me.tamkungz.signals.Signal<T> signal(Class<T> eventType, com.velocitypowered.api.event.PostOrder order)
      Description copied from interface: EventSignalSource
      Returns the signal for an event type with the given post order.
      Specified by:
      signal in interface EventSignalSource
      Type Parameters:
      T - event type
      Parameters:
      eventType - Velocity event type
      order - order in which the underlying Velocity handler runs relative to other handlers
      Returns:
      the signal for that combination
    • players

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

      public ServerSignals servers()
      Returns shortcuts for backend server events.
      Returns:
      server signals
    • proxy

      public ProxySignals proxy()
      Returns shortcuts for proxy events.
      Returns:
      proxy signals