Inventory.setItem (int index, ItemStack item). Allows you to set an itemstack to specific slot in inventory. Suggested name: UCC Inventory Lock What I want: I run a creative Minecraft server that uses the clock to easily access commands on the fly at any time. I need some type of plugin that will lock the 9th inventory slot from being modified (or dropped), and for a clock to always be there, but all other inventory slots to be accessible.
This event is called when a player clicks 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 forInventoryClickEvent using the HumanEntity or InventoryView associated withthis event:
To invoke one of these methods, schedule a task usingBukkitScheduler.runTask(Plugin, Runnable)
Inventory Slot Plugin Minecraft 1.8.9
, which will run the taskon the next tick. Also be aware that this is not an exhaustive list, andother methods could potentially create issues as well.Assuming the EntityHuman associated with this event is an instance of aPlayer, manipulating the MaxStackSize or contents of an Inventory willrequire an Invocation of Player.updateInventory()
.
Inventory Slot Plugin Minecraft 1.12.2
Modifications to slots that are modified by the results of thisInventoryClickEvent can be overwritten. To change these slots, this eventshould 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, wouldwork as well.