@@ -108,7 +108,10 @@ else if (extraElement.isJsonObject())
108108 ChatItem .debug ("[JsonManipulator] Parsed quick: " + obj .toString () + ", wrapper: " + wrapper );
109109 return ChatManager .replaceSeparator (chat , wrapper .toString (), replacement );
110110 }
111- obj .add ("extra" , parseArray (obj .has ("extra" ) ? obj .getAsJsonArray ("extra" ) : new JsonArray (), wrapper ));
111+ if (!obj .has ("extra" ))
112+ obj .add ("extra" , new JsonArray ());
113+ ChatItem .debug ("Parsing array " + obj .getAsJsonArray ("extra" ) + " FROM: " + obj + ". Result: " + parseArray (obj .getAsJsonArray ("extra" ), wrapper ));
114+ obj .add ("extra" , parseArray (obj .getAsJsonArray ("extra" ), wrapper ));
112115 if (!obj .has ("text" )) {
113116 obj .addProperty ("text" , "" );
114117 }
@@ -147,25 +150,21 @@ public String parseEmpty(Chat chat, String json, List<String> tooltip, Player se
147150
148151 private JsonArray parseArray (JsonArray arr , JsonElement tooltip ) {
149152 JsonArray replacer = new JsonArray ();
150- boolean separator = false ;
151153 for (int i = 0 ; i < arr .size (); ++i ) {
152154 JsonElement element = arr .get (i );
153155 if (element .isJsonNull ())
154156 continue ;
155- if (separator ) {
157+ /* if(separator) {
156158 if(ChatManager.containsSeparatorEnd(element.toString()))
157159 separator = false;
158160 continue;
159- }
161+ }*/
160162 if (element .isJsonObject ()) {
161163 JsonObject o = element .getAsJsonObject ();
162164 JsonElement text = o .get ("text" );
165+ ChatItem .debug ("adding JsonObject " + o + " (text: " + text + ")" );
163166 if (text != null && !text .getAsString ().isEmpty ()) {
164- if (ChatManager .containsSeparator (text .getAsString ()) && !ChatManager .containsSeparatorEnd (text .getAsString ())) // if the separator doesn't end in the same string as it's begin
165- separator = true ;
166- if (!ChatManager .containsSeparator (o .toString ())) {
167- addParsedStringToArray (text .getAsString (), replacer , o , tooltip );
168- }
167+ addParsedStringToArray (text .getAsString (), replacer , o , tooltip );
169168 }
170169 if (o .has ("extra" ) && !o .get ("extra" ).getAsJsonArray ().isEmpty ()) {
171170 JsonArray jar = o .get ("extra" ).getAsJsonArray ();
@@ -184,8 +183,6 @@ private JsonArray parseArray(JsonArray arr, JsonElement tooltip) {
184183 }
185184 } else if (element .isJsonPrimitive ()) {
186185 if (ChatManager .containsSeparator (element .getAsString ())) {
187- if (!ChatManager .containsSeparatorEnd (element .getAsString ())) // if the separator doesn't end in the same string as it's begin
188- separator = true ;
189186 addParsedStringToArray (element .getAsString (), replacer , element , tooltip );
190187 } else
191188 replacer .add (element ); // add basic element
0 commit comments