InventoryClickEvent (Spigot

您所在的位置:网站首页 我的世界什么键打开物品栏 InventoryClickEvent (Spigot

InventoryClickEvent (Spigot

2024-07-16 03:03| 来源: 网络整理| 查看: 265

当玩家点击物品栏中的格子时触发事件事件. 译注:事实上打开任意容器的物品栏(包括玩家的背包)后点击任何一个地方都会触发这个事件。

由于InventoryClickEvent是通过修改物品栏 的实现类来触发的,所以并非所有与物品栏相关的方法都是安全的。

下面这些属于HumanEntity和 InventoryView的方法不应该被处理 InventoryClickEvent事件的 事件处理器调用

HumanEntity.closeInventory() HumanEntity.openInventory(Inventory) HumanEntity.openWorkbench(Location, boolean) HumanEntity.openEnchanting(Location, boolean) InventoryView.close() 如果一定要调用这些方法,请使用 BukkitScheduler.runTask(Plugin, Runnable)来执行 ,这个方法将在下一个tick执行你的任务。 注意:上面列出来的这些方法并不全,可能还有其它的方法也存在问题。

Assuming the EntityHuman associated with this event is an instance of a Player, manipulating the MaxStackSize or contents of an Inventory will require an Invocation of Player.updateInventory().

Modifications to slots that are modified by the results of this InventoryClickEvent can be overwritten. To change these slots, this event should be cancelled and all desired changes to the inventory applied. Alternatively, scheduling a task using BukkitScheduler.runTask(Plugin, Runnable), which would execute the task on the next tick, would work as well.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3