skip mojang login if offline (or better Config.skipAuthentication is set)

This commit is contained in:
bixilon 2020-06-12 13:20:35 +02:00
parent d40379f975
commit 1e40bf73e9
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 8 additions and 0 deletions

View File

@ -16,4 +16,5 @@ package de.bixilon.minosoft;
public class Config {
public static String homeDir;
public static String configFileName = "game.yml";
public static boolean skipAuthentication = true; // only for offline developement#
}

View File

@ -13,6 +13,7 @@
package de.bixilon.minosoft.mojang.api;
import de.bixilon.minosoft.Config;
import de.bixilon.minosoft.Minosoft;
import de.bixilon.minosoft.config.GameConfiguration;
import de.bixilon.minosoft.logging.Log;
@ -51,6 +52,9 @@ public class MojangAuthentication {
}
public static void joinServer(MojangAccount account, String serverId) {
if (Config.skipAuthentication) {
return;
}
JSONObject payload = new JSONObject();
payload.put("accessToken", account.getAccessToken());
@ -73,6 +77,9 @@ public class MojangAuthentication {
}
public static String refresh(String clientToken, String accessToken) {
if (Config.skipAuthentication) {
return clientToken;
}
JSONObject payload = new JSONObject();
payload.put("accessToken", accessToken);
payload.put("clientToken", clientToken);