diff --git a/internal/v1_15_R1/pom.xml b/internal/v1_15_R1/pom.xml index eddab53..2000c76 100644 --- a/internal/v1_15_R1/pom.xml +++ b/internal/v1_15_R1/pom.xml @@ -32,7 +32,7 @@ org.spigotmc spigot - 1.15.1-R0.1-SNAPSHOT + 1.15.2-R0.1-SNAPSHOT provided diff --git a/internal/v1_15_R1/src/main/java/com/lishid/openinv/internal/v1_15_R1/SpecialEnderChest.java b/internal/v1_15_R1/src/main/java/com/lishid/openinv/internal/v1_15_R1/SpecialEnderChest.java index 52a5546..de70b04 100644 --- a/internal/v1_15_R1/src/main/java/com/lishid/openinv/internal/v1_15_R1/SpecialEnderChest.java +++ b/internal/v1_15_R1/src/main/java/com/lishid/openinv/internal/v1_15_R1/SpecialEnderChest.java @@ -33,6 +33,7 @@ import org.bukkit.entity.HumanEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.InventoryHolder; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class SpecialEnderChest extends InventoryEnderChest implements ISpecialEnderChest { @@ -115,7 +116,7 @@ public class SpecialEnderChest extends InventoryEnderChest implements ISpecialEn } @Override - public Location getLocation() { + public @Nullable Location getLocation() { return null; } @@ -204,7 +205,7 @@ public class SpecialEnderChest extends InventoryEnderChest implements ISpecialEn } @Override - public boolean isNotEmpty() { + public boolean isEmpty() { for (ItemStack itemstack : this.items) { if (!itemstack.isEmpty()) { diff --git a/internal/v1_15_R1/src/main/java/com/lishid/openinv/internal/v1_15_R1/SpecialPlayerInventory.java b/internal/v1_15_R1/src/main/java/com/lishid/openinv/internal/v1_15_R1/SpecialPlayerInventory.java index 19d2de6..ff59d3c 100644 --- a/internal/v1_15_R1/src/main/java/com/lishid/openinv/internal/v1_15_R1/SpecialPlayerInventory.java +++ b/internal/v1_15_R1/src/main/java/com/lishid/openinv/internal/v1_15_R1/SpecialPlayerInventory.java @@ -326,7 +326,7 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP } if (!this.a(itemstack, itemstack1)) { - remains -= (itemstack1.getMaxStackSize() < this.getMaxStackSize() ? itemstack1.getMaxStackSize() : this.getMaxStackSize()) - itemstack1.getCount(); + remains -= Math.min(itemstack1.getMaxStackSize(), this.getMaxStackSize()) - itemstack1.getCount(); } if (remains <= 0) { @@ -461,14 +461,12 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP k = this.getMaxStackSize() - itemstack1.getCount(); } - if (k == 0) { - return j; - } else { + if (k != 0) { j -= k; itemstack1.add(k); itemstack1.d(5); - return j; } + return j; } @Override @@ -656,12 +654,12 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP } @Override - public boolean isNotEmpty() { - Iterator iterator = this.items.iterator(); + public boolean isEmpty() { + Iterator iterator = this.items.iterator(); ItemStack itemstack; while (iterator.hasNext()) { - itemstack = (ItemStack)iterator.next(); + itemstack = iterator.next(); if (!itemstack.isEmpty()) { return false; } @@ -670,7 +668,7 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP iterator = this.armor.iterator(); while (iterator.hasNext()) { - itemstack = (ItemStack)iterator.next(); + itemstack = iterator.next(); if (!itemstack.isEmpty()) { return false; } @@ -679,7 +677,7 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP iterator = this.extraSlots.iterator(); while (iterator.hasNext()) { - itemstack = (ItemStack)iterator.next(); + itemstack = iterator.next(); if (!itemstack.isEmpty()) { return false; } @@ -711,7 +709,7 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP ItemStack itemstack = this.armor.get(0); int index = i; if (itemstack.getItem() instanceof ItemArmor) { - itemstack.damage((int) f, this.player, (entityhuman) -> entityhuman.c(EnumItemSlot.a(EnumItemSlot.Function.ARMOR, index))); + itemstack.damage((int) f, this.player, (entityhuman) -> entityhuman.broadcastItemBreak(EnumItemSlot.a(EnumItemSlot.Function.ARMOR, index))); } } }