diff --git a/src/main/java/de/epiceric/shopchest/nms/JsonBuilder.java b/src/main/java/de/epiceric/shopchest/nms/JsonBuilder.java index abde80c..377d4c0 100644 --- a/src/main/java/de/epiceric/shopchest/nms/JsonBuilder.java +++ b/src/main/java/de/epiceric/shopchest/nms/JsonBuilder.java @@ -134,12 +134,11 @@ public class JsonBuilder { } } - public void parse(String text) { + public static Part parse(String text) { Matcher matcher = PART_PATTERN.matcher(text); if (!matcher.find()) { - rootPart = new Part(text); - return; + return new Part(text); } matcher.reset(); @@ -199,7 +198,7 @@ public class JsonBuilder { lastEndIndex = endIndex; } - rootPart = array; + return array; } @Override diff --git a/src/main/java/de/epiceric/shopchest/utils/Utils.java b/src/main/java/de/epiceric/shopchest/utils/Utils.java index 4944f10..51d9f97 100644 --- a/src/main/java/de/epiceric/shopchest/utils/Utils.java +++ b/src/main/java/de/epiceric/shopchest/utils/Utils.java @@ -328,9 +328,9 @@ public class Utils { clickEvent.put("action", new JsonBuilder.Part("open_url")); clickEvent.put("value", new JsonBuilder.Part(plugin.getDownloadLink())); - jb.parse(LanguageUtils.getMessage(Message.UPDATE_AVAILABLE, new Replacement(Placeholder.VERSION, plugin.getLatestVersion()))); - - JsonBuilder.PartMap rootPart = jb.getRootPart().toMap(); + JsonBuilder.PartMap rootPart = JsonBuilder.parse(LanguageUtils.getMessage(Message.UPDATE_AVAILABLE, + new Replacement(Placeholder.VERSION, plugin.getLatestVersion()))).toMap(); + rootPart.setValue("hoverEvent", new JsonBuilder.PartMap(hoverEvent)); rootPart.setValue("clickEvent", new JsonBuilder.PartMap(clickEvent));