diff --git a/pom.xml b/pom.xml index dceabe5d..17da4eb3 100644 --- a/pom.xml +++ b/pom.xml @@ -88,12 +88,12 @@ org.spigotmc spigot - 1.15-R0.1-SNAPSHOT + 1.15.2-R0.1-SNAPSHOT org.spigotmc spigot - 1.15-R0.1-SNAPSHOT + 1.15.2-R0.1-SNAPSHOT diff --git a/src/main/java/me/libraryaddict/disguise/utilities/params/ParamInfoManager.java b/src/main/java/me/libraryaddict/disguise/utilities/params/ParamInfoManager.java index 47dc826e..61a7299d 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/params/ParamInfoManager.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/params/ParamInfoManager.java @@ -12,6 +12,7 @@ import me.libraryaddict.disguise.utilities.params.types.custom.ParamInfoSoundGro import me.libraryaddict.disguise.utilities.parser.DisguisePerm; import me.libraryaddict.disguise.utilities.watchers.DisguiseMethods; import org.bukkit.ChatColor; +import org.bukkit.Material; import org.bukkit.boss.BarColor; import org.bukkit.boss.BarStyle; import org.bukkit.inventory.ItemStack; @@ -53,7 +54,7 @@ public class ParamInfoManager { } if (method.getDeclaringClass() == FallingBlockWatcher.class && - method.getParameterTypes()[0] == ItemStack.class) { + (method.getParameterTypes()[0] == Material.class || method.getParameterTypes()[0] == ItemStack.class)) { return getParamInfoItemBlock(); } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/params/types/custom/ParamInfoItemBlock.java b/src/main/java/me/libraryaddict/disguise/utilities/params/types/custom/ParamInfoItemBlock.java index b0e29f44..a92fa5d8 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/params/types/custom/ParamInfoItemBlock.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/params/types/custom/ParamInfoItemBlock.java @@ -50,7 +50,7 @@ public class ParamInfoItemBlock extends ParamInfoItemStack { Material material = ReflectionManager.getMaterial(split[0].toLowerCase()); - if (material == null) { + if (material == null || material == Material.AIR) { material = Material.getMaterial(split[0].toUpperCase()); } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java index cffabd2a..eb4ea2cb 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java @@ -1446,11 +1446,19 @@ public class ReflectionManager { public static int getCombinedIdByItemStack(ItemStack itemStack) { try { - Object nmsItem = getNmsItem(itemStack); - Object item = getNmsMethod("ItemStack", "getItem").invoke(nmsItem); + Object nmsBlock; Class blockClass = getNmsClass("Block"); - Object nmsBlock = getNmsMethod(blockClass, "asBlock", getNmsClass("Item")).invoke(null, item); + if (NmsVersion.v1_13.isSupported()) { + nmsBlock = getCraftMethod("util.CraftMagicNumbers", "getBlock", Material.class) + .invoke(null, itemStack.getType()); + } else { + Object nmsItem = getNmsItem(itemStack); + + Object item = getNmsMethod("ItemStack", "getItem").invoke(nmsItem); + + nmsBlock = getNmsMethod(blockClass, "asBlock", getNmsClass("Item")).invoke(null, item); + } Object iBlockData = getNmsMethod(blockClass, "getBlockData").invoke(nmsBlock);