Class EnderChestGuiListener

java.lang.Object
com.enhancedechest.listener.EnderChestGuiListener
All Implemented Interfaces:
org.bukkit.event.Listener

public final class EnderChestGuiListener extends Object implements org.bukkit.event.Listener
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    void
    onClickMarkTouched(org.bukkit.event.inventory.InventoryClickEvent event)
    Records that the shared chest was actually edited, for the activity log.
    void
    onClose(org.bukkit.event.inventory.InventoryCloseEvent event)
    Detaches the closing player from the shared session on every close, regardless of reason.
    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.
    void
    onDragMarkTouched(org.bukkit.event.inventory.InventoryDragEvent event)
    Same as onClickMarkTouched(org.bukkit.event.inventory.InventoryClickEvent) for a drag that spreads items into the chest.
    void
    onQuit(org.bukkit.event.player.PlayerQuitEvent event)
    Backstop cleanup for lastDenySoundAt: unconditional, since a quitting player might not have had a chest open (nothing to do) or might have closed without firing onClose(org.bukkit.event.inventory.InventoryCloseEvent) (the same edge case PlayerQuitListener backstops for sessions).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      1. 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).
      2. 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 at MONITOR with ignoreCancelled, 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 as onClickMarkTouched(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 from detach using the per-viewer source block.
    • onQuit

      public void onQuit(org.bukkit.event.player.PlayerQuitEvent event)
      Backstop cleanup for lastDenySoundAt: unconditional, since a quitting player might not have had a chest open (nothing to do) or might have closed without firing onClose(org.bukkit.event.inventory.InventoryCloseEvent) (the same edge case PlayerQuitListener backstops for sessions). Idempotent — a no-op if the entry is already gone.