Fix serializing of more complex items such as player heads, don't include setArmor in disguise string but instead rely on sethelmet etc

This commit is contained in:
libraryaddict
2020-10-09 10:09:37 +13:00
parent be34a2c84a
commit 1ed3a149ea
3 changed files with 33 additions and 11 deletions

View File

@@ -114,11 +114,11 @@ public class ParamInfoItemStack extends ParamInfoEnum {
String[] split;
// If it matches /give @p stone {data}
if (string.matches("[^{]+?[ -]\\{.+?}")) {
if (string.matches("^[^{]+?[ -]\\{[.].+?}$")) {
split = string.substring(0, string.indexOf("{") - 1).split("[ -]");
split = Arrays.copyOf(split, split.length + 1);
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[0] = string.substring(0, string.indexOf("{"));
split[string.endsWith("}") ? 1 : 2] = string