diff options
author | md_5 <git@md-5.net> | 2018-07-28 10:23:32 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-07-28 10:23:32 +1000 |
commit | 392108bf94d4377f3a6b517a7f549ca41872c34e (patch) | |
tree | 3a2f5a09b933bf71dc4271c1d19b7506b7f7ab36 | |
parent | 5c2585068b57952ccb63300b75c2b85cdf190ec5 (diff) | |
download | craftbukkit-392108bf94d4377f3a6b517a7f549ca41872c34e.tar craftbukkit-392108bf94d4377f3a6b517a7f549ca41872c34e.tar.gz craftbukkit-392108bf94d4377f3a6b517a7f549ca41872c34e.tar.lz craftbukkit-392108bf94d4377f3a6b517a7f549ca41872c34e.tar.xz craftbukkit-392108bf94d4377f3a6b517a7f549ca41872c34e.zip |
SPIGOT-4168: Patch up some legacy calls
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index 94afb704..dd7b3d76 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -26,6 +26,7 @@ import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; import org.bukkit.Material; import org.bukkit.craftbukkit.util.CraftChatMessage; +import org.bukkit.craftbukkit.util.CraftLegacy; public class CraftInventory implements Inventory { protected final IInventory inventory; @@ -99,6 +100,7 @@ public class CraftInventory implements Inventory { public boolean contains(Material material) { Validate.notNull(material, "Material cannot be null"); + material = CraftLegacy.fromLegacy(material); for (ItemStack item : getStorageContents()) { if (item != null && item.getType() == material) { return true; @@ -121,6 +123,7 @@ public class CraftInventory implements Inventory { public boolean contains(Material material, int amount) { Validate.notNull(material, "Material cannot be null"); + material = CraftLegacy.fromLegacy(material); if (amount <= 0) { return true; } @@ -166,6 +169,7 @@ public class CraftInventory implements Inventory { public HashMap<Integer, ItemStack> all(Material material) { Validate.notNull(material, "Material cannot be null"); + material = CraftLegacy.fromLegacy(material); HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>(); ItemStack[] inventory = getStorageContents(); @@ -193,7 +197,8 @@ public class CraftInventory implements Inventory { public int first(Material material) { Validate.notNull(material, "Material cannot be null"); - ItemStack[] inventory = getStorageContents(); + material = CraftLegacy.fromLegacy(material); + ItemStack[] inventory = getStorageContents(); for (int i = 0; i < inventory.length; i++) { ItemStack item = inventory[i]; if (item != null && item.getType()== material) { @@ -234,6 +239,7 @@ public class CraftInventory implements Inventory { public int firstPartial(Material material) { Validate.notNull(material, "Material cannot be null"); + material = CraftLegacy.fromLegacy(material); ItemStack[] inventory = getStorageContents(); for (int i = 0; i < inventory.length; i++) { ItemStack item = inventory[i]; @@ -373,6 +379,7 @@ public class CraftInventory implements Inventory { public void remove(Material material) { Validate.notNull(material, "Material cannot be null"); + material = CraftLegacy.fromLegacy(material); ItemStack[] items = getStorageContents(); for (int i = 0; i < items.length; i++) { if (items[i] != null && items[i].getType()== material) { |