public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable
Event.Result
player
Constructor and Description |
---|
PlayerItemConsumeEvent(Player player,
ItemStack item) |
Modifier and Type | Method and Description |
---|---|
static HandlerList |
getHandlerList() |
HandlerList |
getHandlers() |
ItemStack |
getItem()
Gets the item that is being consumed.
|
ItemStack |
getReplacement()
Return the custom item stack that will replace the consumed item, or null if no
custom replacement has been set (which means the default replacement will be used).
|
boolean |
isCancelled()
Gets the cancellation state of this event.
|
void |
setCancelled(boolean cancel)
Sets the cancellation state of this event.
|
void |
setItem(ItemStack item)
Set the item being consumed
|
void |
setReplacement(ItemStack replacement)
Set a custom item stack to replace the consumed item.
|
getPlayer
callEvent, getEventName, isAsynchronous
@NotNull public ItemStack getItem()
setItem(org.bukkit.inventory.ItemStack)
instead.public void setItem(@Nullable ItemStack item)
item
- the item being consumed@Nullable public ItemStack getReplacement()
public void setReplacement(@Nullable ItemStack replacement)
replacement
- Replacement item to set, null to clear any custom stack and use defaultpublic boolean isCancelled()
Cancellable
isCancelled
in interface Cancellable
public void setCancelled(boolean cancel)
Cancellable
setCancelled
in interface Cancellable
cancel
- true if you wish to cancel this event@NotNull public HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static HandlerList getHandlerList()
Copyright © 2022. All rights reserved.