#1433: HumanEntity#openInventory(InventoryView) should only support views belonging to the player

By: Miles Holder <mwholder2005@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2024-06-22 18:48:51 +10:00
parent aef018b9c4
commit 477394d314

View File

@ -371,6 +371,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public void openInventory(InventoryView inventory) {
Preconditions.checkArgument(this.equals(inventory.getPlayer()), "InventoryView must belong to the opening player");
if (!(getHandle() instanceof EntityPlayer)) return; // TODO: NPC support?
if (((EntityPlayer) getHandle()).connection == null) return;
if (getHandle().containerMenu != getHandle().inventoryMenu) {