Fix remaining legacy Gson syntax errors
This commit is contained in:
@@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
@@ -17,7 +18,7 @@ import org.bukkit.Bukkit;
|
||||
public class DataManager {
|
||||
|
||||
private final ETPlaceholdersPlugin plugin;
|
||||
private final Gson gson = new Gson();
|
||||
private final JsonParser jsonParser = new JsonParser();
|
||||
|
||||
private final Map<String, Map<Integer, String>> leaderboardCache = new ConcurrentHashMap<>();
|
||||
|
||||
@@ -84,9 +85,9 @@ public class DataManager {
|
||||
|
||||
if (conn.getResponseCode() == 200) {
|
||||
try (InputStreamReader reader = new InputStreamReader(conn.getInputStream())) {
|
||||
JsonObject json = gson.fromJson(reader, JsonObject.class);
|
||||
JsonObject json = jsonParser.parse(reader).getAsJsonObject();
|
||||
if (json != null && json.has("data")) {
|
||||
JsonArray data = json.getAsJsonArray("data");
|
||||
JsonArray data = json.get("data").getAsJsonArray();
|
||||
Map<Integer, String> modeTopNames = new ConcurrentHashMap<>();
|
||||
Map<Integer, String> modeTopTiers = new ConcurrentHashMap<>();
|
||||
|
||||
@@ -128,7 +129,7 @@ public class DataManager {
|
||||
HttpURLConnection conn = createConnection("/players/" + playerName);
|
||||
if (conn.getResponseCode() == 200) {
|
||||
try (InputStreamReader reader = new InputStreamReader(conn.getInputStream())) {
|
||||
JsonObject json = gson.fromJson(reader, JsonObject.class);
|
||||
JsonObject json = jsonParser.parse(reader).getAsJsonObject();
|
||||
if (json != null) {
|
||||
Map<String, String> pTiers = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user