geforkt von Mirrors/Paper
SPIGOT-4168: Patch up some legacy calls
Dieser Commit ist enthalten in:
Ursprung
5c2585068b
Commit
392108bf94
@ -26,6 +26,7 @@ import org.bukkit.inventory.InventoryHolder;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||||
|
import org.bukkit.craftbukkit.util.CraftLegacy;
|
||||||
|
|
||||||
public class CraftInventory implements Inventory {
|
public class CraftInventory implements Inventory {
|
||||||
protected final IInventory inventory;
|
protected final IInventory inventory;
|
||||||
@ -99,6 +100,7 @@ public class CraftInventory implements Inventory {
|
|||||||
|
|
||||||
public boolean contains(Material material) {
|
public boolean contains(Material material) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
|
material = CraftLegacy.fromLegacy(material);
|
||||||
for (ItemStack item : getStorageContents()) {
|
for (ItemStack item : getStorageContents()) {
|
||||||
if (item != null && item.getType() == material) {
|
if (item != null && item.getType() == material) {
|
||||||
return true;
|
return true;
|
||||||
@ -121,6 +123,7 @@ public class CraftInventory implements Inventory {
|
|||||||
|
|
||||||
public boolean contains(Material material, int amount) {
|
public boolean contains(Material material, int amount) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
|
material = CraftLegacy.fromLegacy(material);
|
||||||
if (amount <= 0) {
|
if (amount <= 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -166,6 +169,7 @@ public class CraftInventory implements Inventory {
|
|||||||
|
|
||||||
public HashMap<Integer, ItemStack> all(Material material) {
|
public HashMap<Integer, ItemStack> all(Material material) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
|
material = CraftLegacy.fromLegacy(material);
|
||||||
HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>();
|
HashMap<Integer, ItemStack> slots = new HashMap<Integer, ItemStack>();
|
||||||
|
|
||||||
ItemStack[] inventory = getStorageContents();
|
ItemStack[] inventory = getStorageContents();
|
||||||
@ -193,6 +197,7 @@ public class CraftInventory implements Inventory {
|
|||||||
|
|
||||||
public int first(Material material) {
|
public int first(Material material) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
|
material = CraftLegacy.fromLegacy(material);
|
||||||
ItemStack[] inventory = getStorageContents();
|
ItemStack[] inventory = getStorageContents();
|
||||||
for (int i = 0; i < inventory.length; i++) {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
ItemStack item = inventory[i];
|
ItemStack item = inventory[i];
|
||||||
@ -234,6 +239,7 @@ public class CraftInventory implements Inventory {
|
|||||||
|
|
||||||
public int firstPartial(Material material) {
|
public int firstPartial(Material material) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
|
material = CraftLegacy.fromLegacy(material);
|
||||||
ItemStack[] inventory = getStorageContents();
|
ItemStack[] inventory = getStorageContents();
|
||||||
for (int i = 0; i < inventory.length; i++) {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
ItemStack item = inventory[i];
|
ItemStack item = inventory[i];
|
||||||
@ -373,6 +379,7 @@ public class CraftInventory implements Inventory {
|
|||||||
|
|
||||||
public void remove(Material material) {
|
public void remove(Material material) {
|
||||||
Validate.notNull(material, "Material cannot be null");
|
Validate.notNull(material, "Material cannot be null");
|
||||||
|
material = CraftLegacy.fromLegacy(material);
|
||||||
ItemStack[] items = getStorageContents();
|
ItemStack[] items = getStorageContents();
|
||||||
for (int i = 0; i < items.length; i++) {
|
for (int i = 0; i < items.length; i++) {
|
||||||
if (items[i] != null && items[i].getType()== material) {
|
if (items[i] != null && items[i].getType()== material) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren