Simplify clearing anvil inventory

This commit is contained in:
Pim van der Loos 2020-11-24 12:30:23 +01:00
parent 602acb0088
commit 9cb58d885d
No known key found for this signature in database
GPG Key ID: C16F020ADAE6D5A8
2 changed files with 1 additions and 16 deletions

View File

@ -205,8 +205,6 @@ public class AnvilHandler extends ArmoredElytraHandler implements Listener
return;
}
int slot = e.getRawSlot();
if (anvilInventory.getItem(0) != null && anvilInventory.getItem(1) != null &&
anvilInventory.getItem(2) != null && anvilInventory.getItem(2).getType() == Material.ELYTRA)
{
@ -228,9 +226,7 @@ public class AnvilHandler extends ArmoredElytraHandler implements Listener
return;
// Clean the anvil's inventory after transferring the items.
cleanAnvilInventory(anvilInventory);
player.updateInventory();
return;
anvilInventory.clear();
}
}
}

View File

@ -4,7 +4,6 @@ import nl.pim16aap2.armoredElytra.ArmoredElytra;
import nl.pim16aap2.armoredElytra.util.XMaterial;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.AnvilInventory;
import org.bukkit.inventory.ItemStack;
/**
@ -24,16 +23,6 @@ abstract class ArmoredElytraHandler
this.creationEnabled = creationEnabled;
}
protected void cleanAnvilInventory(AnvilInventory anvilInventory)
{
if (anvilInventory.getItem(0) != null)
anvilInventory.getItem(0).setAmount(0);
if (anvilInventory.getItem(1) != null)
anvilInventory.getItem(1).setAmount(anvilInventory.getItem(1).getAmount() - 1);
if (anvilInventory.getItem(2) != null)
anvilInventory.getItem(2).setAmount(0);
}
// Repair an Armored Elytra
protected short repairItem(short curDur, ItemStack repairItem)
{