diff --git a/pom.xml b/pom.xml index 5aabdb8..7d8215f 100644 --- a/pom.xml +++ b/pom.xml @@ -34,13 +34,13 @@ spigot-1.10 1.10.2-R0.1-SNAPSHOT provided - + --> org.spigotmc spigot-1.11 1.11.2-R0.1-SNAPSHOT provided - --> + org.spigotmc spigot-1.12 @@ -53,12 +53,18 @@ 1.13-R0.1-SNAPSHOT provided - - org.spigotmc - spigot-1.13.1 - 1.13.1-R0.1-SNAPSHOT - provided - + + org.spigotmc + spigot-1.13.1 + 1.13.1-R0.1-SNAPSHOT + provided + + + org.spigotmc + spigot-1.14 + 1.14-R0.1-SNAPSHOT + provided + diff --git a/src/main/java/nl/pim16aap2/armoredElytra/nbtEditor/NBTEditor.java b/src/main/java/nl/pim16aap2/armoredElytra/nbtEditor/NBTEditor.java index bc88f69..8c95042 100644 --- a/src/main/java/nl/pim16aap2/armoredElytra/nbtEditor/NBTEditor.java +++ b/src/main/java/nl/pim16aap2/armoredElytra/nbtEditor/NBTEditor.java @@ -116,7 +116,15 @@ public class NBTEditor setTag = NBTTagCompound.getMethod("set", String.class, NBTBase); NBTTagList = getNMSClass("NBTTagList"); - addCompound = NBTTagList.getMethod("add", NBTBase); + // Starting in 1.14, you also need to provide an int value when adding nbt tags. + try + { + addCompound = NBTTagList.getMethod("add", NBTBase); + } + catch (Exception e) + { + addCompound = NBTTagList.getMethod("add", int.class, NBTBase); + } setCompoundTagList = NBTTagCompound.getMethod("set", String.class, NBTBase); setCompoundByte = NBTTagCompound.getMethod("set", String.class, NBTBase); @@ -130,6 +138,14 @@ public class NBTEditor } } + private void addCompound(Object instance, Object nbtbase) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException + { + if (addCompound.getParameterCount() == 2) + addCompound.invoke(instance, 0, nbtbase); + else + addCompound.invoke(instance, nbtbase); + } + // Add armor to the supplied item, based on the armorTier. public ItemStack addArmorNBTTags(ItemStack item, ArmorTier armorTier, boolean unbreakable) { @@ -155,7 +171,7 @@ public class NBTEditor setTag.invoke (armor, "UUIDLeast", NBTTagIntCtor.newInstance(894654)); setTag.invoke (armor, "UUIDMost", NBTTagIntCtor.newInstance(2872)); setTag.invoke (armor, "Slot", NBTTagStringCtor.newInstance("chest")); - addCompound.invoke(modifiers, armor); + addCompound(modifiers, armor); Object armorTough = NBTTagCompound.newInstance(); setTag.invoke (armorTough, "AttributeName", NBTTagStringCtor.newInstance("generic.armorToughness")); @@ -165,7 +181,7 @@ public class NBTEditor setTag.invoke (armorTough, "UUIDLeast", NBTTagIntCtor.newInstance(894654)); setTag.invoke (armorTough, "UUIDMost", NBTTagIntCtor.newInstance(2872)); setTag.invoke (armorTough, "Slot", NBTTagStringCtor.newInstance("chest")); - addCompound.invoke(modifiers, armorTough); + addCompound(modifiers, armorTough); if (unbreakable) setCompoundByte.invoke(compound, "Unbreakable", NBTTagByteCtor.newInstance((byte) 1)); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 1d46cac..864b40a 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: ArmoredElytra main: nl.pim16aap2.armoredElytra.ArmoredElytra version: 2.4.8 -author: Pim +author: pim16aap2 commands: ArmoredElytra: description: Give an armored elytra of the specified tier.