diff options
author | Hex <hex@hex.lc> | 2018-07-16 22:47:47 -0600 |
---|---|---|
committer | Hex <hex@hex.lc> | 2018-07-16 22:47:47 -0600 |
commit | 1526726b579646244d3253d87a425a257719644b (patch) | |
tree | 4135d7b257a456ecdf8d59809f3f8108662ca292 /src/main/java | |
parent | b4bff6fc3d3f80a7e297624f5d9dbf3ec7d6f6aa (diff) | |
download | craftbukkit-1526726b579646244d3253d87a425a257719644b.tar craftbukkit-1526726b579646244d3253d87a425a257719644b.tar.gz craftbukkit-1526726b579646244d3253d87a425a257719644b.tar.lz craftbukkit-1526726b579646244d3253d87a425a257719644b.tar.xz craftbukkit-1526726b579646244d3253d87a425a257719644b.zip |
SPIGOT-4031: Improve bounds checking in CraftInventoryView.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java index dadfce6e..ed57a7e2 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java @@ -50,7 +50,7 @@ public class CraftInventoryView extends InventoryView { @Override public void setItem(int slot, ItemStack item) { net.minecraft.server.ItemStack stack = CraftItemStack.asNMSCopy(item); - if (slot != -999) { + if (slot >= 0) { container.getSlot(slot).set(stack); } else { player.getHandle().drop(stack, false); @@ -59,7 +59,7 @@ public class CraftInventoryView extends InventoryView { @Override public ItemStack getItem(int slot) { - if (slot == -999) { + if (slot < 0) { return null; } return CraftItemStack.asCraftMirror(container.getSlot(slot).getItem()); @@ -125,7 +125,7 @@ public class CraftInventoryView extends InventoryView { // Nothing to do, it's a CONTAINER slot } } else { - if (slot == -999 || slot == -1) { + if (slot < 0) { type = SlotType.OUTSIDE; } else if (inventory.getType() == InventoryType.CRAFTING) { // Also includes creative inventory if (slot < 9) { |