Package io.papermc.paper.event.player
Class PlayerPickItemEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
io.papermc.paper.event.player.PlayerPickItemEvent
- All Implemented Interfaces:
Cancellable
Event that is fired when a player uses the pick item functionality (middle-clicking a block to get the appropriate
item). However, note that this event will only trigger if an item has to be moved from the inventory to the hotbar.
After the handling of this event, the contents of the source and the target slot will be swapped and the currently
selected hotbar slot of the player will be set to the target slot.
Note: This event will not be fired for players in creative mode.
-
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull HandlerList
@org.jetbrains.annotations.Range(from=0L, to=35L) int
Returns the slot in which the item that will be put into the players hotbar is located.@org.jetbrains.annotations.Range(from=0L, to=8L) int
Returns the slot the item that is being picked goes into.boolean
Gets the cancellation state of this event.void
setCancelled
(boolean cancel) Sets the cancellation state of this event.void
setSourceSlot
(@org.jetbrains.annotations.Range(from=0L, to=35L) int sourceSlot) Change the source slot from which the item that will be put in the players hotbar will be taken.void
setTargetSlot
(@org.jetbrains.annotations.Range(from=0L, to=8L) int targetSlot) Changes the slot the item that is being picked goes into.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayer
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerPickItemEvent
-
-
Method Details
-
getTargetSlot
public @org.jetbrains.annotations.Range(from=0L, to=8L) int getTargetSlot()Returns the slot the item that is being picked goes into.- Returns:
- hotbar slot (0-8 inclusive)
-
setTargetSlot
public void setTargetSlot(@org.jetbrains.annotations.Range(from=0L, to=8L) int targetSlot) Changes the slot the item that is being picked goes into.- Parameters:
targetSlot
- hotbar slot (0-8 inclusive)
-
getSourceSlot
public @org.jetbrains.annotations.Range(from=0L, to=35L) int getSourceSlot()Returns the slot in which the item that will be put into the players hotbar is located.- Returns:
- player inventory slot (0-35 inclusive)
-
setSourceSlot
public void setSourceSlot(@org.jetbrains.annotations.Range(from=0L, to=35L) int sourceSlot) Change the source slot from which the item that will be put in the players hotbar will be taken.- Parameters:
sourceSlot
- player inventory slot (0-35 inclusive)
-
isCancelled
public boolean isCancelled()Description copied from interface:Cancellable
Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
isCancelled
in interfaceCancellable
- Returns:
- true if this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:Cancellable
Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-