From 0b387818580dc10ecd252ac5f991536c970d433d Mon Sep 17 00:00:00 2001 From: Gravita Date: Wed, 8 Jun 2022 23:17:35 +0700 Subject: [PATCH] [FIX] HttpAuthCoreProvider small fixes --- .../src/main/java/pro/gravit/launchserver/HttpRequester.java | 3 +++ .../gravit/launchserver/auth/core/HttpAuthCoreProvider.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/HttpRequester.java b/LaunchServer/src/main/java/pro/gravit/launchserver/HttpRequester.java index fae7b1c4..0545b615 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/HttpRequester.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/HttpRequester.java @@ -29,6 +29,9 @@ public HttpHelper.HttpOptional applyJson(JsonElement response, i if(statusCode < 200 || statusCode >= 300) { return new HttpHelper.HttpOptional<>(null, Launcher.gsonManager.gson.fromJson(response, SimpleError.class), statusCode); } + if(type == Void.class) { + return new HttpHelper.HttpOptional<>(null, null, statusCode); + } return new HttpHelper.HttpOptional<>(Launcher.gsonManager.gson.fromJson(response, type), null, statusCode); } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/HttpAuthCoreProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/HttpAuthCoreProvider.java index c2ca5844..21b5b6b0 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/HttpAuthCoreProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/core/HttpAuthCoreProvider.java @@ -150,12 +150,12 @@ protected boolean updateServerID(User user, String serverID) throws IOException @Override public User checkServer(Client client, String username, String serverID) throws IOException { - return requester.send(requester.post(checkServerUrl, new CheckServerRequest(username, serverID), null), HttpUser.class).getOrThrow(); + return requester.send(requester.post(checkServerUrl, new CheckServerRequest(username, serverID), bearerToken), HttpUser.class).getOrThrow(); } @Override public boolean joinServer(Client client, String username, String accessToken, String serverID) throws IOException { - var result = requester.send(requester.post(joinServerUrl, new JoinServerRequest(username, accessToken, serverID), null), Void.class); + var result = requester.send(requester.post(joinServerUrl, new JoinServerRequest(username, accessToken, serverID), bearerToken), Void.class); return result.isSuccessful(); }