类 PlayerItemConsumeEvent
- 所有已实现的接口:
Cancellable
如果修改了ItemStack,服务器将使用新ItemStack的效果,而不是从玩家的背包中删除原始ItemStack。
如果事件被取消,则不会应用效果,并且不会从玩家的背包中删除该ItemStack。
原文:
This event will fire when a player is finishing consuming an item (food,
potion, milk bucket).
If the ItemStack is modified the server will use the effects of the new
item and not remove the original one from the player's inventory.
If the event is cancelled the effect will not be applied and the item will
not be removed from the player's inventory.
-
嵌套类概要
从类继承的嵌套类/接口 org.bukkit.event.Event
Event.Result
-
字段概要
从类继承的字段 org.bukkit.event.player.PlayerEvent
player
-
构造器概要
构造器说明PlayerItemConsumeEvent
(@NotNull Player player, @NotNull ItemStack item) 已过时。PlayerItemConsumeEvent
(@NotNull Player player, @NotNull ItemStack item, @NotNull EquipmentSlot hand) -
方法概要
修饰符和类型方法说明getHand()
Get the hand used to consume the item.static @NotNull HandlerList
getItem()
获取正在被消耗掉的ItemStack.boolean
获取这个事件是否被取消.一个被取消的事件不会在服务器里执行,但是仍然会传递事件到其他插件.void
setCancelled
(boolean cancel) 取消这个事件.void
设置正在被消耗掉的ItemStack从类继承的方法 org.bukkit.event.player.PlayerEvent
getPlayer
从类继承的方法 org.bukkit.event.Event
getEventName, isAsynchronous
-
构造器详细资料
-
PlayerItemConsumeEvent
public PlayerItemConsumeEvent(@NotNull @NotNull Player player, @NotNull @NotNull ItemStack item, @NotNull @NotNull EquipmentSlot hand) - 参数:
player
- 正在消耗物品的玩家item
- 将要被消耗掉的物品hand
- 使用的手
-
PlayerItemConsumeEvent
@Deprecated public PlayerItemConsumeEvent(@NotNull @NotNull Player player, @NotNull @NotNull ItemStack item) - 参数:
player
- 正在消耗物品的玩家item
- 将要被消耗掉的物品
-
-
方法详细资料
-
getItem
获取正在被消耗掉的ItemStack. 修改本方法返回的ItemStack将无效,你必须使用setItem(org.bukkit.inventory.ItemStack)
方法来取代.原文: Gets the item that is being consumed. Modifying the returned item will have no effect, you must use
setItem(org.bukkit.inventory.ItemStack)
instead.- 返回:
- 正在被消耗掉的
ItemStack
.
-
setItem
设置正在被消耗掉的ItemStack原文: Set the item being consumed
- 参数:
item
- 正在被消耗掉的ItemStack
-
getHand
Get the hand used to consume the item.- 返回:
- the hand
-
isCancelled
public boolean isCancelled()从接口复制的说明: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
- 指定者:
isCancelled
在接口中Cancellable
- 返回:
- 如果事件已经被取消,则为true
-
setCancelled
public void setCancelled(boolean cancel) 从接口复制的说明: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.
- 指定者:
setCancelled
在接口中Cancellable
- 参数:
cancel
- 如果你想取消这个事件,则为true
-
getHandlers
- 指定者:
getHandlers
在类中Event
-
getHandlerList
-
PlayerItemConsumeEvent(Player, ItemStack, EquipmentSlot)