Make JsonBuilder.parse static

This commit is contained in:
Eric 2018-07-26 13:44:44 +02:00
parent 720fceaba1
commit 3c0790d670
2 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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));