Package com.ultikits.ultitools.manager
Class PlayerEventManager
java.lang.Object
com.ultikits.ultitools.manager.PlayerEventManager
- All Implemented Interfaces:
org.bukkit.event.Listener
Player event manager.
Handles WebSocket messages for player-related events.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether this instance has already hooked itself into the Bukkit event system. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) booleanLets tests assert the idempotency guard's state.voidshutdown()Unregisters the event listener and detaches the association with the client.
-
Field Details
-
listenerRegistered
private volatile boolean listenerRegisteredWhether this instance has already hooked itself into the Bukkit event system.In 6.3.0 the protocol v1
initializemethod (removed in 6.4.0) was called by the v1 manager wiring (removed in 6.3.1), which was itself hung on the WebSocket'sonConnectHandler-- 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 caseinitializegets 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.
-