Package io.papermc.paper.event.player
Class PlayerInventorySlotChangeEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
io.papermc.paper.event.player.PlayerInventorySlotChangeEvent
Called when a slot contents change in a player's inventory.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.player.PlayerEvent
player
-
Constructor Summary
ConstructorDescriptionPlayerInventorySlotChangeEvent
(Player player, int rawSlot, ItemStack oldItemStack, ItemStack newItemStack) -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerList
Clone of ItemStack that is in the slot after the change.Clone of ItemStack that was in the slot before the change.int
The raw slot number that was changed.int
getSlot()
The slot number that was changed, ready for passing toInventory.getItem(int)
.void
setShouldTriggerAdvancements
(boolean triggerAdvancements) Sets whether the slot change advancements will be triggered.boolean
Gets whether the slot change advancements will be triggered.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayer
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerInventorySlotChangeEvent
-
-
Method Details
-
getRawSlot
public int getRawSlot()The raw slot number that was changed.- Returns:
- The raw slot number.
-
getSlot
public int getSlot()The slot number that was changed, ready for passing toInventory.getItem(int)
. Note that there may be two slots with the same slot number, since a view links two different inventories.If no inventory is opened, internal crafting view is used for conversion.
- Returns:
- The slot number.
-
getOldItemStack
Clone of ItemStack that was in the slot before the change.- Returns:
- The old ItemStack in the slot.
-
getNewItemStack
Clone of ItemStack that is in the slot after the change.- Returns:
- The new ItemStack in the slot.
-
shouldTriggerAdvancements
public boolean shouldTriggerAdvancements()Gets whether the slot change advancements will be triggered.- Returns:
- Whether the slot change advancements will be triggered.
-
setShouldTriggerAdvancements
public void setShouldTriggerAdvancements(boolean triggerAdvancements) Sets whether the slot change advancements will be triggered.- Parameters:
triggerAdvancements
- Whether the slot change advancements will be triggered.
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-