JavaScript is disabled on your browser.
  • Class

Bukkit Inventory Slot Numbers Free

Numbers

Books may be signed from off hand. Gets the inventory slot number for the book item that triggered this event. This is a slot number on the player's hotbar in the range 0-8, or -1 for off hand. Returns: the inventory slot number that the book item occupies. In Bukkit, inventory view slots are referenced by slot IDs. However, there are many types of inventory views, which can lead to confusion of which ID belongs to which slot. This page shows all raw slot IDs of all inventory views for ease of reference. Inventory views are sorted alphabetically. If you use the PrepareAnvilEvent you can get the different items in an anvil inventory. If you use event.getResult you will get the item in the result slot. Or if you want to set the item in the result slot its event.setResult(itemstack); To get the two item that are in the Inventory you can use inventory.getItem(1) or inventory.getItem(2). Finds all slots in the inventory containing any ItemStacks with the given ItemStack. This will only match slots if both the type and the amount of the stack match The HashMap contains entries where, the key is the slot index, and the value is the ItemStack in that slot. #slotlock contains the players slots you want locked (0-39). #(0-8) are the hot-bar, (9-35) are the inventory, and (36-39) is the armor. #item is the item locked in the slot, amount is the amount of items, #permission is the permission node you must have for the slots to be locked, #name is the item name, and lore is the item lore.

Class InventoryClickEvent

          • org.bukkit.event.inventory.InventoryClickEvent

Bukkit Inventory Slot Numbers Youtube

Bukkit Inventory Slot Numbers
  • All Implemented Interfaces:
    Cancellable
    Direct Known Subclasses:
    CraftItemEvent, InventoryCreativeEvent
    This event is called when a player clicks a slot in an inventory.

    Because InventoryClickEvent occurs within a modification of the Inventory, not all Inventory related methods are safe to use.

    The following should never be invoked by an EventHandler for InventoryClickEvent using the HumanEntity or InventoryView associated with this event:

    To invoke one of these methods, schedule a task using BukkitScheduler.runTask(Plugin, Runnable), which will run the task on the next tick. Also be aware that this is not an exhaustive list, and other methods could potentially create issues as well.

    Assuming the EntityHuman associated with this event is an instance of a Player, manipulating the MaxStackSize or contents of an Inventory will require an Invocation of Player.updateInventory().

    Modifications to slots that are modified by the results of this InventoryClickEvent can be overwritten. To change these slots, this event should be cancelled and all desired changes to the inventory applied. Alternatively, scheduling a task using BukkitScheduler.runTask( Plugin, Runnable), which would execute the task on the next tick, would work as well.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.bukkit.event.Event

        Event.Result
    • Field Summary

      • Fields inherited from class org.bukkit.event.inventory.InventoryEvent

        transaction
    • Constructor Summary

      Constructors
      ConstructorDescription
      InventoryClickEvent​(InventoryView view, InventoryType.SlotType type, int slot, ClickType click, InventoryAction action)
      InventoryClickEvent​(InventoryView view, InventoryType.SlotType type, int slot, ClickType click, InventoryAction action, int key)
    • Method Summary

      All MethodsStatic MethodsInstance MethodsConcrete MethodsDeprecated Methods
      Modifier and TypeMethodDescription
      InventoryActiongetAction()
      Gets the InventoryAction that triggered this event.
      ClickTypegetClick()
      InventorygetClickedInventory()
      Gets the inventory that was clicked, or null if outside of window
      ItemStackgetCurrentItem()
      ItemStackgetCursor()
      Gets the current ItemStack on the cursor.
      static HandlerListgetHandlerList()
      HandlerListgetHandlers()
      intgetHotbarButton()
      If the ClickType is NUMBER_KEY, this method will return the index of the pressed key (0-8).
      intgetRawSlot()
      The raw slot number clicked, ready for passing to #getItem(int) This slot number is unique for the view.
      intgetSlot()
      The slot number that was clicked, ready for passing to Inventory.getItem(int).
      InventoryType.SlotTypegetSlotType()
      booleanisLeftClick()
      Gets whether or not the ClickType for this event represents a left click.
      booleanisRightClick()
      Gets whether or not the ClickType for this event represents a right click.
      booleanisShiftClick()
      Gets whether the ClickType for this event indicates that the key was pressed down when the click was made.
      voidsetCurrentItem​(ItemStack stack)
      voidsetCursor​(ItemStack stack)
      Deprecated.
      This changes the ItemStack in their hand before any calculations are applied to the Inventory, which has a tendency to create inconsistencies between the Player and the server, and to make unexpected changes in the behavior of the clicked Inventory.
      • Methods inherited from class org.bukkit.event.Event

        callEvent, getEventName, isAsynchronous
      • Methods inherited from class org.bukkit.event.inventory.InventoryEvent

        getInventory, getView, getViewers
      • Methods inherited from class org.bukkit.event.inventory.InventoryInteractEvent

        getResult, getWhoClicked, isCancelled, setCancelled, setResult
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Numbers
    • Constructor Detail

      • InventoryClickEvent

      • InventoryClickEvent

    • Method Detail

      • getClickedInventory

        Gets the inventory that was clicked, or null if outside of window
        Returns:
        The clicked inventory
      • getSlotType

        Returns:
        the slot type
      • getCursor

        Gets the current ItemStack on the cursor.
        Returns:
        the cursor ItemStack
      • getCurrentItem

        Returns:
        the item in the clicked
      • isRightClick

        Gets whether or not the ClickType for this event represents a right click.
        Returns:
        true if the ClickType uses the right mouse button.
        See Also:
        ClickType.isRightClick()
      • isLeftClick

        Gets whether or not the ClickType for this event represents a left click.
        Returns:
        true if the ClickType uses the left mouse button.
        See Also:
        ClickType.isLeftClick()
      • isShiftClick

        Gets whether the ClickType for this event indicates that the key was pressed down when the click was made.
        Returns:
        true if the ClickType uses Shift or Ctrl.
        See Also:
        ClickType.isShiftClick()
      • setCursor

        Deprecated.
        This changes the ItemStack in their hand before any calculations are applied to the Inventory, which has a tendency to create inconsistencies between the Player and the server, and to make unexpected changes in the behavior of the clicked Inventory.
        Parameters:
        stack - the new cursor item
      • setCurrentItem

        Sets the ItemStack currently in the clicked slot.
        Parameters:
        stack - the item to be placed in the current slot
      • getSlot

        The slot number that was clicked, ready for passing to Inventory.getItem(int). Note that there may be two slots with the same slot number, since a view links two different inventories.
        Returns:
        The slot number.
      • getRawSlot

        The raw slot number clicked, ready for passing to #getItem(int) This slot number is unique for the view.
        Returns:
        the slot number
      • getHotbarButton

        If the ClickType is NUMBER_KEY, this method will return the index of the pressed key (0-8).
        Returns:
        the number on the key minus 1 (range 0-8); or -1 if not a NUMBER_KEY action
      • getAction

        Gets the InventoryAction that triggered this event.

        This action cannot be changed, and represents what the normal outcome of the event will be. To change the behavior of this InventoryClickEvent, changes must be manually applied.

        Returns:
        the InventoryAction that triggered this event.
      • getClick

        Gets the ClickType for this event.

        This is insulated against changes to the inventory by other plugins.

        Returns:
        the type of inventory click
      • getHandlers

        Overrides:
        getHandlers in class InventoryEvent
      • getHandlerList

  • Class
JavaScript is disabled on your browser.
  • Summary:
  • Nested
  • Field
  • Constr
Bukkit inventory slot numbers 2020Bukkit Inventory Slot Numbers
  • Detail:
  • Field
  • Constr

Copyright © 2019. All rights reserved.

Modifier and TypeMethodDescription
voidclose()
intconvertSlot​(int rawSlot)
Converts a raw slot ID into its local slot ID into whichever of the twoinventories the slot points to.
intcountSlots()
Check the total number of slots in this view, combining the upper andlower inventories.
abstract InventorygetBottomInventory()
Get the lower inventory involved in this transaction.
ItemStackgetCursor()
Get the item on the cursor of one of the viewing players.
InventorygetInventory​(int rawSlot)
Gets the inventory corresponding to the given raw slot ID.
ItemStackgetItem​(int slot)
Gets one item in this inventory view by its raw slot ID.
abstract HumanEntitygetPlayer()
InventoryType.SlotTypegetSlotType​(int slot)
Determine the type of the slot by its raw slot ID.
abstract StringgetTitle()
abstract InventorygetTopInventory()
Get the upper inventory involved in this transaction.
abstract InventoryTypegetType()
Determine the type of inventory involved in the transaction.
voidsetCursor​(ItemStack item)
Sets the item on the cursor of one of the viewing players.
voidsetItem​(int slot,ItemStack item)
Sets one item in this inventory view by its raw slot ID.
booleansetProperty​(InventoryView.Property prop,int value)
Sets an extra property of this inventory if supported by thatinventory, for example the state of a progress bar.
Coments are closed
Scroll to top