Skip to content

Commit

Permalink
idk - ci ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
xxAROX committed Oct 16, 2023
1 parent da8cdf3 commit 9df0a7a
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import cn.nukkit.Server;
import cn.nukkit.scheduler.AsyncTask;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import okhttp3.*;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -32,7 +31,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) {
if (response.code() == 200) {
try {
String responseBody = Objects.requireNonNull(response.body()).string();
JsonObject result = parseJsonResponse(responseBody);
JsonObject result = PresenceMan.GSON.fromJson(responseBody, JsonObject.class);
if (result != null && !result.isEmpty()) {
Integer port = result.has("port") && !result.get("port").isJsonNull() ? result.get("port").getAsInt() : null;
Gateway.protocol = result.get("protocol").getAsString();
Expand Down Expand Up @@ -60,11 +59,6 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
});
}

private JsonObject parseJsonResponse(String responseBody) {
Gson gson = new Gson();
return gson.fromJson(responseBody, JsonObject.class);
}

public static void ping_backend(Consumer<Boolean> callback) {
if (ReconnectingTask.active) return;

Expand Down

0 comments on commit 9df0a7a

Please sign in to comment.