Paper/Spigot-Server-Patches/0272-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch
Aikar 18c3716c49
Current Chunk for Entity and Block Entities, counts by entity type
This enables us a fast reference to the entities current chunk instead
of having to look it up by hashmap lookups.

We also store counts by type to further enable other performance optimizations in later patches.
2018-07-04 03:58:56 -04:00

32 lines
1.3 KiB
Diff

From 5676d0f94137d1699144f04e16f1b34fa2ecc116 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 10 Mar 2018 13:03:49 +0000
Subject: [PATCH] Fix NPE when getting location from InventoryEnderChest opened
by plugins
diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java
index cd7de2b53..37b494b78 100644
--- a/src/main/java/net/minecraft/server/InventoryEnderChest.java
+++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java
@@ -5,7 +5,7 @@ import org.bukkit.inventory.InventoryHolder;
public class InventoryEnderChest extends InventorySubcontainer {
- private TileEntityEnderChest a;
+ private TileEntityEnderChest a; public TileEntityEnderChest getTileEntity() { return a; } // Paper - OBFHELPER
// CraftBukkit start
private final EntityHuman owner;
@@ -15,6 +15,7 @@ public class InventoryEnderChest extends InventorySubcontainer {
@Override
public Location getLocation() {
+ if (getTileEntity() == null) return null; // Paper - return null if there is no TE bound (opened by plugin)
return new Location(this.a.getWorld().getWorld(), this.a.getPosition().getX(), this.a.getPosition().getY(), this.a.getPosition().getZ());
}
--
2.18.0