Class PlayerEventManager

java.lang.Object
com.ultikits.ultitools.manager.PlayerEventManager
All Implemented Interfaces:
org.bukkit.event.Listener

@Internal public class PlayerEventManager extends Object implements org.bukkit.event.Listener
Player event manager. Handles WebSocket messages for player-related events.
  • Field Details

    • listenerRegistered

      private volatile boolean listenerRegistered
      Whether this instance has already hooked itself into the Bukkit event system.

      In 6.3.0 the protocol v1 initialize method (removed in 6.4.0) was called by the v1 manager wiring (removed in 6.3.1), which was itself hung on the WebSocket's onConnectHandler -- it ran on every single onOpen. Without this guard, N disconnect-reconnect cycles would register N copies of the listener, and the same player event would be sent out N times. See issue #180.

  • Constructor Details

    • PlayerEventManager

      public PlayerEventManager()
  • Method Details

    • shutdown

      public void shutdown()
      Unregisters the event listener and detaches the association with the client.

      Called by PluginInitiationUtils.disableCloud() -- i.e. after /ulticloud logout. Distinct from a "disconnect-and-reconnect": in that case initialize gets called back afterward, so unregistering would just mean re-registering again; this method handles the case where the cloud feature was explicitly turned off, and the listener should genuinely be detached.

    • isListenerRegistered

      boolean isListenerRegistered()
      Lets tests assert the idempotency guard's state.