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

public class PlayerInventorySlotChangeEvent extends PlayerEvent
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

Constructors
Constructor
Description
`PlayerInventorySlotChangeEvent(@NotNull Player player, int rawSlot, @NotNull ItemStack oldItemStack, @NotNull ItemStack newItemStack)`

## Method Summary

Modifier and Type
Method
Description
`static @NotNull HandlerList`
`getHandlerList()`
`@NotNull HandlerList`
`getHandlers()`
`@NotNull ItemStack`
`getNewItemStack()`
Clone of ItemStack that is in the slot after the change.
`@NotNull ItemStack`
`getOldItemStack()`
Clone of ItemStack that was in the slot before the change.
`int`
`getRawSlot()`
The raw slot number that was changed.
`int`
`getSlot()`
The slot number that was changed, ready for passing to `Inventory.getItem(int)`.
`void`
`setShouldTriggerAdvancements(boolean triggerAdvancements)`
Sets whether the slot change advancements will be triggered.
`boolean`
`shouldTriggerAdvancements()`
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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### PlayerInventorySlotChangeEvent

public PlayerInventorySlotChangeEvent(@NotNull @NotNull Player player, int rawSlot, @NotNull @NotNull ItemStack oldItemStack, @NotNull @NotNull ItemStack newItemStack)

## 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 to `Inventory.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

@NotNull public @NotNull ItemStack getOldItemStack()
Clone of ItemStack that was in the slot before the change.

Returns:
  The old ItemStack in the slot.

### getNewItemStack

@NotNull public @NotNull ItemStack 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

@NotNull public @NotNull HandlerList getHandlers()

Specified by:
  `getHandlers` in class `Event`

### getHandlerList

@NotNull public static @NotNull HandlerList getHandlerList()