Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Aust1n46/VentureChat
Browse files Browse the repository at this point in the history
  • Loading branch information
Aust1n46 committed Feb 10, 2023
2 parents 915639d + 46b0a3c commit d7d66e1
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/main/java/mineverse/Aust1n46/chat/utilities/Format.java
Expand Up @@ -68,10 +68,9 @@ public class Format {
*/
public static String convertToJson(MineverseChatPlayer sender, String format, String chat) {
JsonFormat JSONformat = JsonFormat.getJsonFormat(sender.getJsonFormat());
String f = escapeJsonChars(format);
String c = escapeJsonChars(chat);
String json = "[\"\",{\"text\":\"\",\"extra\":[";
json += convertPlaceholders(f, JSONformat, sender);
json += convertPlaceholders(format, JSONformat, sender);
json += "]}";
json += "," + convertLinks(c);
json += "]";
Expand Down Expand Up @@ -111,8 +110,8 @@ private static String convertPlaceholders(String s, JsonFormat format, Mineverse
indexStart = matcher.start();
indexEnd = matcher.end();
placeholder = remaining.substring(indexStart, indexEnd);
formattedPlaceholder = Format.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), placeholder));
temp += convertToJsonColors(lastCode + remaining.substring(0, indexStart)) + ",";
formattedPlaceholder = escapeJsonChars(Format.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), placeholder)));
temp += convertToJsonColors(escapeJsonChars(lastCode + remaining.substring(0, indexStart))) + ",";
lastCode = getLastCode(lastCode + remaining.substring(0, indexStart));
boolean placeholderHasJsonAttribute = false;
for (JsonAttribute jsonAttribute : format.getJsonAttributes()) {
Expand All @@ -123,8 +122,8 @@ private static String convertPlaceholders(String s, JsonFormat format, Mineverse
}
final String hoverText;
if(!hover.isEmpty()) {
hoverText = Format.FormatStringAll(
PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), hover.substring(0, hover.length() - 1)));
hoverText = escapeJsonChars(Format.FormatStringAll(
PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), hover.substring(0, hover.length() - 1))));
} else {
hoverText = StringUtils.EMPTY;
}
Expand All @@ -133,8 +132,8 @@ private static String convertPlaceholders(String s, JsonFormat format, Mineverse
if (clickAction == ClickAction.NONE) {
actionJson = StringUtils.EMPTY;
} else {
final String clickText = Format.FormatStringAll(
PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), jsonAttribute.getClickText()));
final String clickText = escapeJsonChars(Format.FormatStringAll(
PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), jsonAttribute.getClickText())));
actionJson = ",\"clickEvent\":{\"action\":\"" + jsonAttribute.getClickAction().toString() + "\",\"value\":\"" + clickText
+ "\"}";
}
Expand Down

0 comments on commit d7d66e1

Please sign in to comment.