Fix #482, unable to disguise as variants with no item equiv
This commit is contained in:
		| @@ -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(); | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -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()); | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -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); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user