fix: Update 1.15 adapter to 1.15.2

This commit is contained in:
Jikoo 2020-11-25 15:24:39 -05:00
parent 804d30bcc7
commit 502f661be3
No known key found for this signature in database
GPG key ID: 37FF68B07F639098
3 changed files with 13 additions and 14 deletions

View file

@ -32,7 +32,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId> <artifactId>spigot</artifactId>
<version>1.15.1-R0.1-SNAPSHOT</version> <version>1.15.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View file

@ -33,6 +33,7 @@ import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class SpecialEnderChest extends InventoryEnderChest implements ISpecialEnderChest { public class SpecialEnderChest extends InventoryEnderChest implements ISpecialEnderChest {
@ -115,7 +116,7 @@ public class SpecialEnderChest extends InventoryEnderChest implements ISpecialEn
} }
@Override @Override
public Location getLocation() { public @Nullable Location getLocation() {
return null; return null;
} }
@ -204,7 +205,7 @@ public class SpecialEnderChest extends InventoryEnderChest implements ISpecialEn
} }
@Override @Override
public boolean isNotEmpty() { public boolean isEmpty() {
for (ItemStack itemstack : this.items) { for (ItemStack itemstack : this.items) {
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {

View file

@ -326,7 +326,7 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
} }
if (!this.a(itemstack, itemstack1)) { 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) { if (remains <= 0) {
@ -461,14 +461,12 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
k = this.getMaxStackSize() - itemstack1.getCount(); k = this.getMaxStackSize() - itemstack1.getCount();
} }
if (k == 0) { if (k != 0) {
return j;
} else {
j -= k; j -= k;
itemstack1.add(k); itemstack1.add(k);
itemstack1.d(5); itemstack1.d(5);
return j;
} }
return j;
} }
@Override @Override
@ -656,12 +654,12 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
} }
@Override @Override
public boolean isNotEmpty() { public boolean isEmpty() {
Iterator iterator = this.items.iterator(); Iterator<ItemStack> iterator = this.items.iterator();
ItemStack itemstack; ItemStack itemstack;
while (iterator.hasNext()) { while (iterator.hasNext()) {
itemstack = (ItemStack)iterator.next(); itemstack = iterator.next();
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {
return false; return false;
} }
@ -670,7 +668,7 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
iterator = this.armor.iterator(); iterator = this.armor.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
itemstack = (ItemStack)iterator.next(); itemstack = iterator.next();
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {
return false; return false;
} }
@ -679,7 +677,7 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
iterator = this.extraSlots.iterator(); iterator = this.extraSlots.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
itemstack = (ItemStack)iterator.next(); itemstack = iterator.next();
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {
return false; return false;
} }
@ -711,7 +709,7 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
ItemStack itemstack = this.armor.get(0); ItemStack itemstack = this.armor.get(0);
int index = i; int index = i;
if (itemstack.getItem() instanceof ItemArmor) { 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)));
} }
} }
} }