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. |                     // Its a misc, we are going to use the MiscDisguise constructor. | ||||||
|                     ItemStack itemStack = new ItemStack(Material.STONE); |                     ItemStack itemStack = new ItemStack(Material.STONE); | ||||||
|                     int miscId = -1; |                     int miscId = -1; | ||||||
|                     int miscData = -1; |  | ||||||
|                     String secondArg = null; |  | ||||||
|  |  | ||||||
|                     if (args.length > 1) { |                     if (args.length > 1) { | ||||||
|                         // They have defined more arguments! |                         switch (disguisePerm.getType()) { | ||||||
|                         // If the first arg is a number |                             case FALLING_BLOCK: | ||||||
|                         if (args[1].contains(":")) { |                             case DROPPED_ITEM: | ||||||
|                             String[] split = args[1].split(":"); |                                 Material material = null; | ||||||
|                             if (isInteger(split[1])) { |  | ||||||
|                                 secondArg = split[1]; |  | ||||||
|                             } |  | ||||||
|                             args[1] = split[0]; |  | ||||||
|                         } |  | ||||||
|  |  | ||||||
|                         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()) { |                                 for (Material mat : Material.values()) { | ||||||
|                                     if (mat.name().replace("_", "").equalsIgnoreCase(args[1].replace("_", ""))) { |                                     if (!mat.name().replace("_", "").equalsIgnoreCase(args[1].replace("_", ""))) { | ||||||
|                                         itemStack = new ItemStack(mat); |                                         continue; | ||||||
|                                         miscId = mat.getId(); |                                     } | ||||||
|                                         break; |  | ||||||
|  |                                     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++; |                                 toSkip++; | ||||||
|                             } |  | ||||||
|                             if (secondArg != null) { |                                 if (disguisePerm.getType() == DisguiseType.FALLING_BLOCK) { | ||||||
|                                 if (disguisePerm.getType() != DisguiseType.FALLING_BLOCK && |                                     usedOptions.add("setblock"); | ||||||
|                                         disguisePerm.getType() != DisguiseType.DROPPED_ITEM) { |                                 } else { | ||||||
|                                     throw new DisguiseParseException(LibsMsg.PARSE_USE_SECOND_NUM, |                                     usedOptions.add("setitemstack"); | ||||||
|                                             DisguiseType.FALLING_BLOCK.toReadable(), |  | ||||||
|                                             DisguiseType.DROPPED_ITEM.toReadable()); |  | ||||||
|                                 } |                                 } | ||||||
|                                 miscData = Integer.parseInt(secondArg); |  | ||||||
|                             } |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|  |  | ||||||
|                     if (!disguiseOptions.isEmpty() && miscId != -1) { |                                 doCheck(sender, permissions, disguisePerm, usedOptions); | ||||||
|                         String toCheck = "" + miscId; |                                 break; | ||||||
|  |                             case PAINTING: | ||||||
|  |                             case SPLASH_POTION: | ||||||
|  |                                 if (!isInteger(args[1])) { | ||||||
|  |                                     break; | ||||||
|  |                                 } | ||||||
|  |  | ||||||
|                         if (miscData == 0 || miscData == -1) { |                                 miscId = Integer.parseInt(args[1]); | ||||||
|                             if (!disguiseOptions.containsKey(toCheck) || !disguiseOptions.get(toCheck)) { |                                 toSkip++; | ||||||
|                                 toCheck += ":0"; |  | ||||||
|                             } |  | ||||||
|                         } else { |  | ||||||
|                             toCheck += ":" + miscData; |  | ||||||
|                         } |  | ||||||
|  |  | ||||||
|                         if (!disguiseOptions.containsKey(toCheck) || !disguiseOptions.get(toCheck)) { |                                 if (!disguiseOptions.isEmpty()) { | ||||||
|                             throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_PARAM, toCheck, |                                     String toCheck = "" + miscId; | ||||||
|                                     disguisePerm.toReadable()); |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|  |  | ||||||
|                     if (miscId != -1) { |                                     if (!disguiseOptions.containsKey(toCheck) || !disguiseOptions.get(toCheck)) { | ||||||
|                         if (disguisePerm.getType() == DisguiseType.FALLING_BLOCK) { |                                         throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_PARAM, toCheck, | ||||||
|                             usedOptions.add("setblock"); |                                                 disguisePerm.toReadable()); | ||||||
|  |                                     } | ||||||
|  |                                 } | ||||||
|  |  | ||||||
|                             doCheck(sender, permissions, disguisePerm, usedOptions); |                                 if (disguisePerm.getType() == DisguiseType.PAINTING) { | ||||||
|                         } else if (disguisePerm.getType() == DisguiseType.PAINTING) { |                                     usedOptions.add("setpainting"); | ||||||
|                             usedOptions.add("setpainting"); |                                 } else { | ||||||
|  |                                     usedOptions.add("setpotionid"); | ||||||
|  |                                 } | ||||||
|  |  | ||||||
|                             doCheck(sender, permissions, disguisePerm, usedOptions); |                                 doCheck(sender, permissions, disguisePerm, usedOptions); | ||||||
|                         } else if (disguisePerm.getType() == DisguiseType.SPLASH_POTION) { |                                 break; | ||||||
|                             usedOptions.add("setpotionid"); |                             default: | ||||||
|  |                                 break; | ||||||
|                             doCheck(sender, permissions, disguisePerm, usedOptions); |  | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
| @@ -339,7 +313,7 @@ public class DisguiseParser { | |||||||
|                             disguisePerm.getType() == DisguiseType.FALLING_BLOCK) { |                             disguisePerm.getType() == DisguiseType.FALLING_BLOCK) { | ||||||
|                         disguise = new MiscDisguise(disguisePerm.getType(), itemStack); |                         disguise = new MiscDisguise(disguisePerm.getType(), itemStack); | ||||||
|                     } else { |                     } else { | ||||||
|                         disguise = new MiscDisguise(disguisePerm.getType(), miscId, miscData); |                         disguise = new MiscDisguise(disguisePerm.getType(), miscId); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user