Package com.enhancedechest.listener
Class EnderChestGuiListener
java.lang.Object
com.enhancedechest.listener.EnderChestGuiListener
- All Implemented Interfaces:
org.bukkit.event.Listener
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonClick(org.bukkit.event.inventory.InventoryClickEvent event) Guards item moves on an open chest GUI: Read-only viewers — an admin viewing someone else's chest without the edit permission — cannot change the shared contents at all; any action touching the top inventory is cancelled (they still see live updates). Temporary chests are take-only for everyone: deposits into the top inventory are cancelled, take-outs left untouched.voidonClickMarkTouched(org.bukkit.event.inventory.InventoryClickEvent event) Records that the shared chest was actually edited, for the activity log.voidonClose(org.bukkit.event.inventory.InventoryCloseEvent event) Detaches the closing player from the shared session on every close, regardless of reason.voidonDrag(org.bukkit.event.inventory.InventoryDragEvent event) Cancels any drag that would spread items into the top inventory slots — rejected outright for a read-only viewer, and for everyone on a temporary (take-only) chest.voidonDragMarkTouched(org.bukkit.event.inventory.InventoryDragEvent event) Same asonClickMarkTouched(org.bukkit.event.inventory.InventoryClickEvent)for a drag that spreads items into the chest.voidonQuit(org.bukkit.event.player.PlayerQuitEvent event) Backstop cleanup forlastDenySoundAt: unconditional, since a quitting player might not have had a chest open (nothing to do) or might have closed without firingonClose(org.bukkit.event.inventory.InventoryCloseEvent)(the same edge casePlayerQuitListenerbackstops for sessions).
-
Constructor Details
-
EnderChestGuiListener
public EnderChestGuiListener()
-
-
Method Details
-
onClick
public void onClick(org.bukkit.event.inventory.InventoryClickEvent event) Guards item moves on an open chest GUI:- Read-only viewers — an admin viewing someone else's chest without the edit permission — cannot change the shared contents at all; any action touching the top inventory is cancelled (they still see live updates).
- Temporary chests are take-only for everyone: deposits into the top inventory are cancelled, take-outs left untouched.
-
onClickMarkTouched
public void onClickMarkTouched(org.bukkit.event.inventory.InventoryClickEvent event) Records that the shared chest was actually edited, for the activity log. Runs atMONITORwithignoreCancelled, so it sees only clicks that survived every handler above (including this class's own read-only and take-only cancellations) and therefore really do reach the chest. Flagging here rather than diffing later lets the log skip building a snapshot at all for the many visits where a player just looks at their chest and closes it. -
onDragMarkTouched
public void onDragMarkTouched(org.bukkit.event.inventory.InventoryDragEvent event) Same asonClickMarkTouched(org.bukkit.event.inventory.InventoryClickEvent)for a drag that spreads items into the chest. -
onDrag
public void onDrag(org.bukkit.event.inventory.InventoryDragEvent event) Cancels any drag that would spread items into the top inventory slots — rejected outright for a read-only viewer, and for everyone on a temporary (take-only) chest. -
onClose
public void onClose(org.bukkit.event.inventory.InventoryCloseEvent event) Detaches the closing player from the shared session on every close, regardless of reason. The service removes them as a viewer and, only when the last viewer leaves, persists the shared contents — so concurrent viewers keep editing the one live inventory with no premature save and no dupe. The close (lid) animation is played fromdetachusing the per-viewer source block. -
onQuit
public void onQuit(org.bukkit.event.player.PlayerQuitEvent event) Backstop cleanup forlastDenySoundAt: unconditional, since a quitting player might not have had a chest open (nothing to do) or might have closed without firingonClose(org.bukkit.event.inventory.InventoryCloseEvent)(the same edge casePlayerQuitListenerbackstops for sessions). Idempotent — a no-op if the entry is already gone.
-