Class CloudOutboxListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Public because UltiTools constructs it from another package. The registration in
UltiTools#onEnable() lives in com.ultikits.ultitools, so the class and its
no-argument constructor have to be visible there; made package-private, it could not be
instantiated from that package at all (S-03). Bukkit is not the reason: Paper registers listener
classes through its method-handle fallback and does not require them to be public. Nothing else
here is public surface: the handler bodies and the payload builder are implementation details,
and the class is marked ApiStatus.Internal so no module treats it as API.
Registered once, decided per event. UltiTools#onEnable() registers this listener a
single time, beside PlayerJoinListener, and never unregisters it while the plugin is
enabled. Whether an event is captured is decided at event time by
CloudSession.offerReliableEvent(String, JsonObject), which returns silently when the
server holds no credential or ultipanel.capabilities.player-events is off (S-16). The
listener is therefore never registered or unregistered from an asynchronous thread, and an
unlinked server writes no state file at all.
Payload. payloadFor(Player) is the single builder of a player.join /
player.leave payload; it delegates to the contract encoder (plan 22-13 through
AgentOutboundFeeds.playerRefPayload(java.lang.String, java.lang.String), plan 22-22), which emits exactly two keys:
playerUuid (the UUID string) and playerName (the name the server reports, a
Floodgate prefix such as .Steve included). A player the contract cannot carry is skipped
with one FINE line. No IP address, display name, location or online-mode flag ever reaches the
outbox (T-22-29, contract answer 15).
Commands (plan 22-22). A player's command is reported live, never buffered (D-14), as
player.command carrying only the normalised command name (D-20): the arguments of any
command, registered as sensitive or not, never leave the server.
Known limitation. A quit fired after the plugin has already been disabled during a server
stop is not captured: Bukkit stops dispatching to a disabled plugin's listeners. The plugin's own
shutdown flush still persists everything captured before that point. Whether the CraftBukkit stop
sequence disables plugins before it removes players is not verified here: the UAT row
ultitools.cloud.outbox.persist-restart (plan 22-28) observes it on a real server, and the
limitation itself belongs on the COMPATIBILITY.md known-limitations list (plan 22-27).
- Since:
- 6.3.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidHands one event to the session that is current now, not the one captured at registration time: a login replaces the session, and the replacement owns the outbox the event belongs in.voidonCommand(org.bukkit.event.player.PlayerCommandPreprocessEvent event) Reports one player command to the live connection by its name only (D-20).voidonJoin(org.bukkit.event.player.PlayerJoinEvent event) Adds oneplayer.joinentry to the current session's outbox.voidonQuit(org.bukkit.event.player.PlayerQuitEvent event) Adds oneplayer.leaveentry to the current session's outbox.(package private) static com.google.gson.JsonObjectpayloadFor(org.bukkit.entity.Player player) The one builder of a join/leave payload (T-22-29).
-
Constructor Details
-
CloudOutboxListener
public CloudOutboxListener()
-
-
Method Details
-
onJoin
public void onJoin(org.bukkit.event.player.PlayerJoinEvent event) Adds oneplayer.joinentry to the current session's outbox.- Parameters:
event- the join event, on the main thread
-
onQuit
public void onQuit(org.bukkit.event.player.PlayerQuitEvent event) Adds oneplayer.leaveentry to the current session's outbox. A kick ends in a quit, so a kicked player produces exactly this one entry.- Parameters:
event- the quit event, on the main thread
-
onCommand
public void onCommand(org.bukkit.event.player.PlayerCommandPreprocessEvent event) Reports one player command to the live connection by its name only (D-20). Nothing is sent while no connection is established orultipanel.capabilities.player-eventsis off. A command another plugin cancelled (a login plugin before the player logged in, a permission plugin) was not run, so it is not reported (22-22 fix).- Parameters:
event- the command event, on the main thread
-
offer
Hands one event to the session that is current now, not the one captured at registration time: a login replaces the session, and the replacement owns the outbox the event belongs in.- Parameters:
type- the envelope typeplayer- the player the event is about
-
payloadFor
static com.google.gson.JsonObject payloadFor(org.bukkit.entity.Player player) The one builder of a join/leave payload (T-22-29). Kept package-private so a test can assert the exact key set without a live server.- Parameters:
player- the player the event is about- Returns:
- a fresh payload object the outbox copies, or
nullwhen the contract cannot carry this player
-