mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Replace SimpleJSON with Gson
This commit is contained in:
parent
8f173ea76c
commit
839c263955
@ -12,9 +12,10 @@ import java.net.URL;
|
|||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.json.simple.JSONArray;
|
|
||||||
import org.json.simple.JSONObject;
|
import com.google.gson.JsonArray;
|
||||||
import org.json.simple.JSONValue;
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
public class CSCoreLibLoader {
|
public class CSCoreLibLoader {
|
||||||
|
|
||||||
@ -62,9 +63,11 @@ public class CSCoreLibLoader {
|
|||||||
connection.setDoOutput(true);
|
connection.setDoOutput(true);
|
||||||
|
|
||||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||||
final JSONArray array = (JSONArray) JSONValue.parse(reader.readLine());
|
final JsonArray array = new JsonParser().parse(reader).getAsJsonArray();
|
||||||
download = traceURL(((String) ((JSONObject) array.get(array.size() - 1)).get("downloadUrl")).replace("https:", "http:"));
|
final JsonObject json = array.get(array.size() - 1).getAsJsonObject();
|
||||||
file = new File("plugins/" + (String) ((JSONObject) array.get(array.size() - 1)).get("name") + ".jar");
|
|
||||||
|
download = traceURL(json.get("downloadUrl").getAsString().replace("https:", "http:"));
|
||||||
|
file = new File("plugins/" + json.get("name").getAsString() + ".jar");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user