@@ -68,10 +68,9 @@ public class Format {
6868 */
6969 public static String convertToJson (MineverseChatPlayer sender , String format , String chat ) {
7070 JsonFormat JSONformat = JsonFormat .getJsonFormat (sender .getJsonFormat ());
71- String f = escapeJsonChars (format );
7271 String c = escapeJsonChars (chat );
7372 String json = "[\" \" ,{\" text\" :\" \" ,\" extra\" :[" ;
74- json += convertPlaceholders (f , JSONformat , sender );
73+ json += convertPlaceholders (format , JSONformat , sender );
7574 json += "]}" ;
7675 json += "," + convertLinks (c );
7776 json += "]" ;
@@ -111,8 +110,8 @@ private static String convertPlaceholders(String s, JsonFormat format, Mineverse
111110 indexStart = matcher .start ();
112111 indexEnd = matcher .end ();
113112 placeholder = remaining .substring (indexStart , indexEnd );
114- formattedPlaceholder = Format .FormatStringAll (PlaceholderAPI .setBracketPlaceholders (icp .getPlayer (), placeholder ));
115- temp += convertToJsonColors (lastCode + remaining .substring (0 , indexStart )) + "," ;
113+ formattedPlaceholder = escapeJsonChars ( Format .FormatStringAll (PlaceholderAPI .setBracketPlaceholders (icp .getPlayer (), placeholder ) ));
114+ temp += convertToJsonColors (escapeJsonChars ( lastCode + remaining .substring (0 , indexStart ) )) + "," ;
116115 lastCode = getLastCode (lastCode + remaining .substring (0 , indexStart ));
117116 boolean placeholderHasJsonAttribute = false ;
118117 for (JsonAttribute jsonAttribute : format .getJsonAttributes ()) {
@@ -123,8 +122,8 @@ private static String convertPlaceholders(String s, JsonFormat format, Mineverse
123122 }
124123 final String hoverText ;
125124 if (!hover .isEmpty ()) {
126- hoverText = Format .FormatStringAll (
127- PlaceholderAPI .setBracketPlaceholders (icp .getPlayer (), hover .substring (0 , hover .length () - 1 )));
125+ hoverText = escapeJsonChars ( Format .FormatStringAll (
126+ PlaceholderAPI .setBracketPlaceholders (icp .getPlayer (), hover .substring (0 , hover .length () - 1 )))) ;
128127 } else {
129128 hoverText = StringUtils .EMPTY ;
130129 }
@@ -133,8 +132,8 @@ private static String convertPlaceholders(String s, JsonFormat format, Mineverse
133132 if (clickAction == ClickAction .NONE ) {
134133 actionJson = StringUtils .EMPTY ;
135134 } else {
136- final String clickText = Format .FormatStringAll (
137- PlaceholderAPI .setBracketPlaceholders (icp .getPlayer (), jsonAttribute .getClickText ()));
135+ final String clickText = escapeJsonChars ( Format .FormatStringAll (
136+ PlaceholderAPI .setBracketPlaceholders (icp .getPlayer (), jsonAttribute .getClickText ()))) ;
138137 actionJson = ",\" clickEvent\" :{\" action\" :\" " + jsonAttribute .getClickAction ().toString () + "\" ,\" value\" :\" " + clickText
139138 + "\" }" ;
140139 }
0 commit comments