From afd147f92ebff384a023346ef828615d6bfdf822 Mon Sep 17 00:00:00 2001 From: Gravita Date: Wed, 29 Jun 2022 17:36:45 +0700 Subject: [PATCH] [FIX] Small fixes --- .../launchserver/manangers/AuthManager.java | 3 +-- .../pro/gravit/launchserver/socket/Client.java | 16 ++++++++-------- .../socket/response/auth/ExitResponse.java | 5 +++++ .../client/ClientLauncherEntryPoint.java | 2 +- props.gradle | 2 +- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java index e751e2d4..ca066ed1 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java @@ -8,7 +8,6 @@ import pro.gravit.launcher.events.request.AuthRequestEvent; import pro.gravit.launcher.profiles.ClientProfile; import pro.gravit.launcher.profiles.PlayerProfile; -import pro.gravit.launcher.profiles.Texture; import pro.gravit.launcher.request.auth.AuthRequest; import pro.gravit.launcher.request.auth.password.*; import pro.gravit.launchserver.LaunchServer; @@ -84,7 +83,7 @@ public boolean accept(Client client, AuthProviderPair pair, String extendedToken if(client.permissions == null) client.permissions = new ClientPermissions(); client.permissions.addPerm("launchserver.checkserver"); client.permissions.addPerm(String.format("launchserver.profile.%s.show", info.serverName)); - client.setSerializableProperty("launchserver.serverName", info.serverName); + client.setProperty("launchserver.serverName", info.serverName); return true; } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java index de6fb8dc..123d359f 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java @@ -10,7 +10,6 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; public class Client { public String auth_id; @@ -32,7 +31,7 @@ public class Client { public transient Map properties; - public Map serializableProperties; + public Map staticProperties; public Client() { timestamp = System.currentTimeMillis(); @@ -65,14 +64,15 @@ public void setProperty(String name, T object) { properties.put(name, object); } - public String getSerializableProperty(String name) { - if (serializableProperties == null) serializableProperties = new HashMap<>(); - return serializableProperties.get(name); + @SuppressWarnings("unchecked") + public T getStaticProperty(String name) { + if (staticProperties == null) staticProperties = new HashMap<>(); + return (T) staticProperties.get(name); } - public void setSerializableProperty(String name, String value) { - if (serializableProperties == null) serializableProperties = new HashMap<>(); - serializableProperties.put(name, value); + public void setStaticProperty(String name, T value) { + if (staticProperties == null) staticProperties = new HashMap<>(); + staticProperties.put(name, value); } public pro.gravit.launchserver.auth.core.User getUser() { diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/ExitResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/ExitResponse.java index 3e7bc176..029bfa50 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/ExitResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/ExitResponse.java @@ -11,6 +11,8 @@ import pro.gravit.launchserver.socket.handlers.WebSocketFrameHandler; import pro.gravit.launchserver.socket.response.SimpleResponse; +import java.util.HashMap; + public class ExitResponse extends SimpleResponse { public boolean exitAll; public String username; @@ -20,6 +22,9 @@ public static void exit(LaunchServer server, WebSocketFrameHandler wsHandler, Ch Client chClient = wsHandler.getClient(); Client newCusClient = new Client(); newCusClient.checkSign = chClient.checkSign; + if(chClient.staticProperties != null) { + newCusClient.staticProperties = new HashMap<>(chClient.staticProperties); + } wsHandler.setClient(newCusClient); ExitRequestEvent event = new ExitRequestEvent(reason); event.requestUUID = RequestEvent.eventUUID; diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java index af76d9f9..06fe6b91 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java @@ -200,7 +200,7 @@ public static void main(String[] args) throws Throwable { CommonHelper.newThread("Asset Directory Watcher", true, assetWatcher).start(); CommonHelper.newThread("Client Directory Watcher", true, clientWatcher).start(); if (javaWatcher != null) - CommonHelper.newThread("Java Directory Watcher", true, clientWatcher).start(); + CommonHelper.newThread("Java Directory Watcher", true, javaWatcher).start(); verifyHDir(assetDir, params.assetHDir, assetMatcher, digest); verifyHDir(clientDir, params.clientHDir, clientMatcher, digest); if (javaWatcher != null) diff --git a/props.gradle b/props.gradle index df4cfa2f..f86ed882 100644 --- a/props.gradle +++ b/props.gradle @@ -1,7 +1,7 @@ project.ext { verAsm = '9.2' verNetty = '4.1.75.Final' - verOshiCore = '6.1.5' + verOshiCore = '6.2.0' verJunit = '5.8.2' verGuavaC = '30.1.1-jre' verJansi = '2.4.0'