Simplify clearing anvil inventory
This commit is contained in:
parent
602acb0088
commit
9cb58d885d
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user