[FIX] Small fixes

This commit is contained in:
Gravita 2022-06-29 17:36:45 +07:00
parent 08fe9b2eb4
commit afd147f92e
5 changed files with 16 additions and 12 deletions

View file

@ -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;
}
}

View file

@ -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<String, Object> properties;
public Map<String, String> serializableProperties;
public Map<String, Object> staticProperties;
public Client() {
timestamp = System.currentTimeMillis();
@ -65,14 +64,15 @@ public <T> 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> 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<T> void setStaticProperty(String name, T value) {
if (staticProperties == null) staticProperties = new HashMap<>();
staticProperties.put(name, value);
}
public pro.gravit.launchserver.auth.core.User getUser() {

View file

@ -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;

View file

@ -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)

View file

@ -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'