Remove obscure old code for disguise construction using commands for 1.13
This commit is contained in:
		| @@ -236,101 +236,75 @@ public class DisguiseParser { | ||||
|                     // Its a misc, we are going to use the MiscDisguise constructor. | ||||
|                     ItemStack itemStack = new ItemStack(Material.STONE); | ||||
|                     int miscId = -1; | ||||
|                     int miscData = -1; | ||||
|                     String secondArg = null; | ||||
|  | ||||
|                     if (args.length > 1) { | ||||
|                         // They have defined more arguments! | ||||
|                         // If the first arg is a number | ||||
|                         if (args[1].contains(":")) { | ||||
|                             String[] split = args[1].split(":"); | ||||
|                             if (isInteger(split[1])) { | ||||
|                                 secondArg = split[1]; | ||||
|                             } | ||||
|                             args[1] = split[0]; | ||||
|                         } | ||||
|                         switch (disguisePerm.getType()) { | ||||
|                             case FALLING_BLOCK: | ||||
|                             case DROPPED_ITEM: | ||||
|                                 Material material = null; | ||||
|  | ||||
|                         if (isInteger(args[1])) { | ||||
|                             miscId = Integer.parseInt(args[1]); | ||||
|                         } else { | ||||
|                             if (disguisePerm.getType() == DisguiseType.FALLING_BLOCK || | ||||
|                                     disguisePerm.getType() == DisguiseType.DROPPED_ITEM) { | ||||
|                                 for (Material mat : Material.values()) { | ||||
|                                     if (mat.name().replace("_", "").equalsIgnoreCase(args[1].replace("_", ""))) { | ||||
|                                         itemStack = new ItemStack(mat); | ||||
|                                         miscId = mat.getId(); | ||||
|                                         break; | ||||
|                                     if (!mat.name().replace("_", "").equalsIgnoreCase(args[1].replace("_", ""))) { | ||||
|                                         continue; | ||||
|                                     } | ||||
|  | ||||
|                                     material = mat; | ||||
|                                     break; | ||||
|                                 } | ||||
|  | ||||
|                                 if (material == null) { | ||||
|                                     break; | ||||
|                                 } | ||||
|  | ||||
|                                 itemStack = new ItemStack(material); | ||||
|  | ||||
|                                 if (!disguiseOptions.isEmpty()) { | ||||
|                                     String toCheck = "" + itemStack.getType().name(); | ||||
|  | ||||
|                                     if (!disguiseOptions.containsKey(toCheck) || !disguiseOptions.get(toCheck)) { | ||||
|                                         throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_PARAM, toCheck, | ||||
|                                                 disguisePerm.toReadable()); | ||||
|                                     } | ||||
|                                 } | ||||
|                             } | ||||
|                         } | ||||
|                         if (miscId != -1) { | ||||
|                             switch (disguisePerm.getType()) { | ||||
|                                 case PAINTING: | ||||
|                                 case FALLING_BLOCK: | ||||
|                                 case SPLASH_POTION: | ||||
|                                 case DROPPED_ITEM: | ||||
|                                 case FISHING_HOOK: | ||||
|                                 case ARROW: | ||||
|                                 case TIPPED_ARROW: | ||||
|                                 case SPECTRAL_ARROW: | ||||
|                                 case SMALL_FIREBALL: | ||||
|                                 case FIREBALL: | ||||
|                                 case WITHER_SKULL: | ||||
|                                 case TRIDENT: | ||||
|                                     break; | ||||
|                                 default: | ||||
|                                     throw new DisguiseParseException(LibsMsg.PARSE_TOO_MANY_ARGS, | ||||
|                                             disguisePerm.toReadable(), args[1]); | ||||
|                             } | ||||
|                             toSkip++; | ||||
|                             // If they also defined a data value | ||||
|                             if (args.length > 2 && secondArg == null && isInteger(args[2])) { | ||||
|                                 secondArg = args[2]; | ||||
|  | ||||
|                                 toSkip++; | ||||
|                             } | ||||
|                             if (secondArg != null) { | ||||
|                                 if (disguisePerm.getType() != DisguiseType.FALLING_BLOCK && | ||||
|                                         disguisePerm.getType() != DisguiseType.DROPPED_ITEM) { | ||||
|                                     throw new DisguiseParseException(LibsMsg.PARSE_USE_SECOND_NUM, | ||||
|                                             DisguiseType.FALLING_BLOCK.toReadable(), | ||||
|                                             DisguiseType.DROPPED_ITEM.toReadable()); | ||||
|  | ||||
|                                 if (disguisePerm.getType() == DisguiseType.FALLING_BLOCK) { | ||||
|                                     usedOptions.add("setblock"); | ||||
|                                 } else { | ||||
|                                     usedOptions.add("setitemstack"); | ||||
|                                 } | ||||
|                                 miscData = Integer.parseInt(secondArg); | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|  | ||||
|                     if (!disguiseOptions.isEmpty() && miscId != -1) { | ||||
|                         String toCheck = "" + miscId; | ||||
|                                 doCheck(sender, permissions, disguisePerm, usedOptions); | ||||
|                                 break; | ||||
|                             case PAINTING: | ||||
|                             case SPLASH_POTION: | ||||
|                                 if (!isInteger(args[1])) { | ||||
|                                     break; | ||||
|                                 } | ||||
|  | ||||
|                         if (miscData == 0 || miscData == -1) { | ||||
|                             if (!disguiseOptions.containsKey(toCheck) || !disguiseOptions.get(toCheck)) { | ||||
|                                 toCheck += ":0"; | ||||
|                             } | ||||
|                         } else { | ||||
|                             toCheck += ":" + miscData; | ||||
|                         } | ||||
|                                 miscId = Integer.parseInt(args[1]); | ||||
|                                 toSkip++; | ||||
|  | ||||
|                         if (!disguiseOptions.containsKey(toCheck) || !disguiseOptions.get(toCheck)) { | ||||
|                             throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_PARAM, toCheck, | ||||
|                                     disguisePerm.toReadable()); | ||||
|                         } | ||||
|                     } | ||||
|                                 if (!disguiseOptions.isEmpty()) { | ||||
|                                     String toCheck = "" + miscId; | ||||
|  | ||||
|                     if (miscId != -1) { | ||||
|                         if (disguisePerm.getType() == DisguiseType.FALLING_BLOCK) { | ||||
|                             usedOptions.add("setblock"); | ||||
|                                     if (!disguiseOptions.containsKey(toCheck) || !disguiseOptions.get(toCheck)) { | ||||
|                                         throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_PARAM, toCheck, | ||||
|                                                 disguisePerm.toReadable()); | ||||
|                                     } | ||||
|                                 } | ||||
|  | ||||
|                             doCheck(sender, permissions, disguisePerm, usedOptions); | ||||
|                         } else if (disguisePerm.getType() == DisguiseType.PAINTING) { | ||||
|                             usedOptions.add("setpainting"); | ||||
|                                 if (disguisePerm.getType() == DisguiseType.PAINTING) { | ||||
|                                     usedOptions.add("setpainting"); | ||||
|                                 } else { | ||||
|                                     usedOptions.add("setpotionid"); | ||||
|                                 } | ||||
|  | ||||
|                             doCheck(sender, permissions, disguisePerm, usedOptions); | ||||
|                         } else if (disguisePerm.getType() == DisguiseType.SPLASH_POTION) { | ||||
|                             usedOptions.add("setpotionid"); | ||||
|  | ||||
|                             doCheck(sender, permissions, disguisePerm, usedOptions); | ||||
|                                 doCheck(sender, permissions, disguisePerm, usedOptions); | ||||
|                                 break; | ||||
|                             default: | ||||
|                                 break; | ||||
|                         } | ||||
|                     } | ||||
|  | ||||
| @@ -339,7 +313,7 @@ public class DisguiseParser { | ||||
|                             disguisePerm.getType() == DisguiseType.FALLING_BLOCK) { | ||||
|                         disguise = new MiscDisguise(disguisePerm.getType(), itemStack); | ||||
|                     } else { | ||||
|                         disguise = new MiscDisguise(disguisePerm.getType(), miscId, miscData); | ||||
|                         disguise = new MiscDisguise(disguisePerm.getType(), miscId); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user