diff --git a/Launcher/src/main/java/pro/gravit/launcher/debug/ClientRuntimeProvider.java b/Launcher/src/main/java/pro/gravit/launcher/debug/ClientRuntimeProvider.java index 82bd51e2..f9a1a682 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/debug/ClientRuntimeProvider.java +++ b/Launcher/src/main/java/pro/gravit/launcher/debug/ClientRuntimeProvider.java @@ -57,7 +57,7 @@ public void run(String[] args) { if(uuid == null) { if(accessToken != null) { Request.setOAuth(authId, new AuthRequestEvent.OAuthRequestEvent(accessToken, refreshToken, expire)); - Request.RequestRestoreReport report = Request.restore(true, false); + Request.RequestRestoreReport report = Request.restore(true, false, true); permissions = report.userInfo.permissions; username = report.userInfo.playerProfile.username; uuid = report.userInfo.playerProfile.uuid.toString(); diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/request/Request.java b/LauncherAPI/src/main/java/pro/gravit/launcher/request/Request.java index 9500de2f..f2b8a418 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/request/Request.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/request/Request.java @@ -159,7 +159,7 @@ public static void reconnect() throws Exception { } public static RequestRestoreReport restore() throws Exception { - return restore(false, false); + return restore(false, false, false); } private synchronized static Map getExpiredExtendedTokens() { @@ -178,16 +178,22 @@ private synchronized static Map getExpiredExtendedTokens() { return makeNewTokens(set); } - public static synchronized RequestRestoreReport restore(boolean needUserInfo, boolean refreshOnly) throws Exception { + public static synchronized RequestRestoreReport restore(boolean needUserInfo, boolean refreshOnly, boolean noRefresh) throws Exception { boolean refreshed = false; RestoreRequest request; if (oauth != null) { - if (isTokenExpired() || oauth.accessToken == null) { - RefreshTokenRequest refreshRequest = new RefreshTokenRequest(authId, oauth.refreshToken); - RefreshTokenRequestEvent event = refreshRequest.request(); - setOAuth(authId, event.oauth); - refreshed = true; + if(isTokenExpired() || oauth.accessToken == null) { + if(noRefresh) { + oauth = null; + } else { + RefreshTokenRequest refreshRequest = new RefreshTokenRequest(authId, oauth.refreshToken); + RefreshTokenRequestEvent event = refreshRequest.request(); + setOAuth(authId, event.oauth); + refreshed = true; + } } + } + if (oauth != null) { request = new RestoreRequest(authId, oauth.accessToken, refreshOnly ? getExpiredExtendedTokens() : getStringExtendedTokens(), needUserInfo); } else { request = new RestoreRequest(authId, null, refreshOnly ? getExpiredExtendedTokens() : getStringExtendedTokens(), false); diff --git a/LauncherClient/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java b/LauncherClient/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java index 70c7c739..64f292fe 100644 --- a/LauncherClient/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java +++ b/LauncherClient/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java @@ -124,7 +124,7 @@ private static void realMain(String[] args) throws Throwable { service = StdWebSocketService.initWebSockets(Launcher.getConfig().address).get(); Request.setRequestService(service); LogHelper.debug("Restore sessions"); - Request.restore(); + Request.restore(false, false, true); service.registerEventHandler(new BasicLauncherEventHandler()); ((StdWebSocketService) service).reconnectCallback = () -> { diff --git a/LauncherCore/src/main/java/pro/gravit/utils/Version.java b/LauncherCore/src/main/java/pro/gravit/utils/Version.java index 69a95013..272fc6be 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/Version.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/Version.java @@ -6,9 +6,9 @@ public final class Version implements Comparable { public static final int MAJOR = 5; public static final int MINOR = 5; - public static final int PATCH = 2; + public static final int PATCH = 3; public static final int BUILD = 1; - public static final Version.Type RELEASE = Type.STABLE; + public static final Version.Type RELEASE = Type.DEV; public final int major; public final int minor; public final int patch;