mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-13 11:15:57 -07:00
@@ -15,6 +15,9 @@ import org.bukkit.util.StringUtil;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.io.Resources;
|
import com.google.common.io.Resources;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonSyntaxException;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@@ -24,9 +27,6 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.json.simple.JSONObject;
|
|
||||||
import org.json.simple.parser.JSONParser;
|
|
||||||
import org.json.simple.parser.ParseException;
|
|
||||||
|
|
||||||
public class VersionCommand extends BukkitCommand {
|
public class VersionCommand extends BukkitCommand {
|
||||||
public VersionCommand(@NotNull String name) {
|
public VersionCommand(@NotNull String name) {
|
||||||
@@ -241,9 +241,9 @@ public class VersionCommand extends BukkitCommand {
|
|||||||
Charsets.UTF_8
|
Charsets.UTF_8
|
||||||
).openBufferedStream();
|
).openBufferedStream();
|
||||||
try {
|
try {
|
||||||
JSONObject obj = (JSONObject) new JSONParser().parse(reader);
|
JsonObject obj = new Gson().fromJson(reader, JsonObject.class);
|
||||||
return ((Number) obj.get("totalCount")).intValue();
|
return obj.get("totalCount").getAsInt();
|
||||||
} catch (ParseException ex) {
|
} catch (JsonSyntaxException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return -1;
|
return -1;
|
||||||
} finally {
|
} finally {
|
||||||
|
Reference in New Issue
Block a user