Quick fix for people not being able to send/receive Translated messages. (#868)

Thanks to 7ate9.
This commit is contained in:
Ian William O'Neill
2019-07-03 19:53:44 +01:00
committed by Ganom
parent 781a1cc2a4
commit 9e7d124d49
2 changed files with 9 additions and 12 deletions

View File

@@ -284,11 +284,6 @@
<artifactId>asm-all</artifactId>
<version>6.0_BETA</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
</dependencies>
<build>

View File

@@ -1,6 +1,7 @@
package net.runelite.client.plugins.chattranslation;
import org.json.JSONArray;
import com.google.gson.JsonArray;
import com.google.gson.JsonParser;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@@ -33,14 +34,15 @@ public class Translator
return parseResult(response.toString());
}
private String parseResult(String inputJson) throws Exception
private String parseResult(String inputJson)
{
//TODO: find a way to do this using google.gson
JSONArray jsonArray = new JSONArray(inputJson);
JSONArray jsonArray2 = (JSONArray) jsonArray.get(0);
JSONArray jsonArray3 = (JSONArray) jsonArray2.get(0);
String result;
JsonArray jsonArray = new JsonParser().parse(inputJson).getAsJsonArray();
JsonArray jsonArray2 = jsonArray.get(0).getAsJsonArray();
JsonArray jsonArray3 = jsonArray2.get(0).getAsJsonArray();
result = jsonArray3.get(0).toString();
return jsonArray3.get(0).toString();
return result.substring(1, result.length() - 1);
}
}