Class WindowClickLogic

java.lang.Object
net.glowstone.inventory.WindowClickLogic

public final class WindowClickLogic extends Object
The complicated logic for determining how window click messages are interpreted.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.event.inventory.InventoryAction
    getAction(org.bukkit.event.inventory.ClickType clickType, org.bukkit.event.inventory.InventoryType.SlotType slot, org.bukkit.inventory.ItemStack cursor, org.bukkit.inventory.ItemStack slotItem)
    Determine the InventoryAction to be performed for a window click based on the click type, slot type, and items involved.
    static org.bukkit.event.inventory.ClickType
    getClickType(int mode, int button, int slot)
    Determine the ClickType of a window click message based on the raw mode, button, and slot values if possible.
    static boolean
    isPickupAction(org.bukkit.event.inventory.InventoryAction action)
    Check if a given InventoryAction involves taking items from the slot.
    static boolean
    isPlaceAction(org.bukkit.event.inventory.InventoryAction action)
    Check if a given InventoryAction involves placing items into the slot.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getClickType

      public static org.bukkit.event.inventory.ClickType getClickType(int mode, int button, int slot)
      Determine the ClickType of a window click message based on the raw mode, button, and slot values if possible.
      Parameters:
      mode - The raw mode number.
      button - The raw button number.
      slot - The raw slot number.
      Returns:
      The ClickType of the window click, or UNKNOWN.
    • getAction

      public static org.bukkit.event.inventory.InventoryAction getAction(org.bukkit.event.inventory.ClickType clickType, org.bukkit.event.inventory.InventoryType.SlotType slot, org.bukkit.inventory.ItemStack cursor, org.bukkit.inventory.ItemStack slotItem)
      Determine the InventoryAction to be performed for a window click based on the click type, slot type, and items involved.
      Parameters:
      clickType - The click type.
      slot - The slot clicked.
      cursor - The item on the cursor.
      slotItem - The item in the slot.
      Returns:
      The InventoryAction to perform, or UNKNOWN.
    • isPlaceAction

      public static boolean isPlaceAction(org.bukkit.event.inventory.InventoryAction action)
      Check if a given InventoryAction involves placing items into the slot.
      Parameters:
      action - The InventoryAction.
      Returns:
      True if the cursor is to be added to the slot.
    • isPickupAction

      public static boolean isPickupAction(org.bukkit.event.inventory.InventoryAction action)
      Check if a given InventoryAction involves taking items from the slot.
      Parameters:
      action - The InventoryAction.
      Returns:
      True if the slot is to be added to the cursor.