Fix incorrect armored elytra creation
- No longer making "armored elytra"s out of non-elytra items.
This commit is contained in:
@ -28,8 +28,7 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
// TODO: Figure out if the config really does read the list of enchantments accurately. A bug report with a customized config seemed to load the default settings...
|
||||
// TODO: Verify enchantments on startup. Remove them from the list if they're invalid.
|
||||
// TODO: Don't delete the config/translation file. Look at BigDoors.
|
||||
// TODO: Verify enchantments on startup.
|
||||
// TODO: Enchanting should require XP.
|
||||
|
||||
public class ArmoredElytra extends JavaPlugin implements Listener
|
||||
@ -58,6 +57,12 @@ public class ArmoredElytra extends JavaPlugin implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
//// Material mat = Material.ELYTRA;
|
||||
//// n3kas.ae.Core.canApplyTo(mat);
|
||||
// for (String str : n3kas.ae.api.getAllEnchantments())
|
||||
// System.out.println(str);
|
||||
// System.exit(0);
|
||||
|
||||
nbtEditor = minecraftVersion.isNewerThan(MinecraftVersion.v1_15) ? new NBTEditor() : new NBTEditor_legacy();
|
||||
if (isBlacklistedVersion())
|
||||
{
|
||||
|
@ -98,9 +98,12 @@ public class EventHandlers implements Listener
|
||||
// Clean >=1.10 inventories.
|
||||
private void cleanAnvilNew(AnvilInventory anvilInventory)
|
||||
{
|
||||
anvilInventory.getItem(0).setAmount(0);
|
||||
anvilInventory.getItem(1).setAmount(anvilInventory.getItem(1).getAmount() - 1);
|
||||
anvilInventory.getItem(2).setAmount(0);
|
||||
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);
|
||||
}
|
||||
|
||||
// Check if the enchantment is allowed on elytras.
|
||||
@ -408,7 +411,7 @@ public class EventHandlers implements Listener
|
||||
int slot = e.getRawSlot();
|
||||
|
||||
if (slot == 2 && anvilInventory.getItem(0) != null && anvilInventory.getItem(1) != null &&
|
||||
anvilInventory.getItem(2) != null)
|
||||
anvilInventory.getItem(2) != null && anvilInventory.getItem(2).getType() == Material.ELYTRA)
|
||||
{
|
||||
ArmorTier armortier = ArmoredElytra.getInstance().getNbtEditor().getArmorTier(anvilInventory.getItem(2));
|
||||
|
||||
|
@ -2,6 +2,7 @@ name: ArmoredElytra
|
||||
main: nl.pim16aap2.armoredElytra.ArmoredElytra
|
||||
version: ${project.version}
|
||||
author: pim16aap2
|
||||
softdepend: [AdvancedEnchantments]
|
||||
api-version: 1.13
|
||||
commands:
|
||||
ArmoredElytra:
|
||||
@ -39,4 +40,4 @@ permissions:
|
||||
armoredelytra.give.diamond:
|
||||
description: Allow the player to spawn in diamond tier armored elytras.
|
||||
armoredElytra.admin:
|
||||
description: Receive a message if this plugin is out of date when joining the server.
|
||||
description: Receive a message if this plugin is out of date when joining the server.
|
||||
|
Reference in New Issue
Block a user