Parse itemstacks and itemstack[]s correctly
This commit is contained in:
		| @@ -106,10 +106,10 @@ public class ParamInfoItemStack extends ParamInfoEnum { | |||||||
|                 split = string.substring(0, string.indexOf("{") - 1).split("[ -]"); |                 split = string.substring(0, string.indexOf("{") - 1).split("[ -]"); | ||||||
|                 split = Arrays.copyOf(split, split.length + 1); |                 split = Arrays.copyOf(split, split.length + 1); | ||||||
|                 split[split.length - 1] = string.substring(string.indexOf("{")); |                 split[split.length - 1] = string.substring(string.indexOf("{")); | ||||||
|             } else if (string.matches("[^{ ]+?\\{.+?}( [0-9]+?)")) { // /give @p stone[data] <amount?> |             } else if (string.matches("[^{ ]+?\\{.+?}( [0-9]+)?")) { // /give @p stone[data] <amount?> | ||||||
|                 split = new String[string.endsWith("}") ? 2 : 3]; |                 split = new String[string.endsWith("}") ? 2 : 3]; | ||||||
|                 split[0] = string.substring(0, string.indexOf("{")); |                 split[0] = string.substring(0, string.indexOf("{")); | ||||||
|                 split[string.endsWith("}") ? 2 : 1] = string |                 split[string.endsWith("}") ? 1 : 2] = string | ||||||
|                         .substring(string.indexOf("{"), string.lastIndexOf("}") + 1); |                         .substring(string.indexOf("{"), string.lastIndexOf("}") + 1); | ||||||
|  |  | ||||||
|                 if (!string.endsWith("}")) { |                 if (!string.endsWith("}")) { | ||||||
|   | |||||||
| @@ -75,6 +75,7 @@ public class ParamInfoItemStackArray extends ParamInfoItemStack { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         // TODO Replace this with better | ||||||
|         String[] split = string.split(",", -1); |         String[] split = string.split(",", -1); | ||||||
|  |  | ||||||
|         if (split.length != 4) { |         if (split.length != 4) { | ||||||
| @@ -85,7 +86,7 @@ public class ParamInfoItemStackArray extends ParamInfoItemStack { | |||||||
|         ItemStack[] items = new ItemStack[4]; |         ItemStack[] items = new ItemStack[4]; | ||||||
|  |  | ||||||
|         for (int a = 0; a < 4; a++) { |         for (int a = 0; a < 4; a++) { | ||||||
|             items[a] = parseToItemstack(split[a].split(":")); |             items[a] = parseToItemstack(split[a]); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return items; |         return items; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user