diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/CheckServerResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/CheckServerResponse.java index 7795a9bb..947e5dcb 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/CheckServerResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/CheckServerResponse.java @@ -16,7 +16,6 @@ public class CheckServerResponse extends SimpleResponse { private transient final Logger logger = LogManager.getLogger(); public String serverID; public String username; - public String serverName; public boolean needHardware; public boolean needProperties; diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/api/ConfigService.java b/LauncherAPI/src/main/java/pro/gravit/launcher/api/ConfigService.java new file mode 100644 index 00000000..01bafb3d --- /dev/null +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/api/ConfigService.java @@ -0,0 +1,11 @@ +package pro.gravit.launcher.api; + +public class ConfigService { + public static boolean disableLogging; + public static String serverName; + public static CheckServerConfig checkServerConfig = new CheckServerConfig(); + public static class CheckServerConfig { + public boolean needProperties; + public boolean needHardware; + } +} diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/request/auth/CheckServerRequest.java b/LauncherAPI/src/main/java/pro/gravit/launcher/request/auth/CheckServerRequest.java index d59fc144..9e3ff5f6 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/request/auth/CheckServerRequest.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/request/auth/CheckServerRequest.java @@ -12,8 +12,6 @@ public final class CheckServerRequest extends Request i @LauncherNetworkAPI public final String serverID; @LauncherNetworkAPI - public String serverName; - @LauncherNetworkAPI public boolean needHardware; @LauncherNetworkAPI public boolean needProperties; @@ -24,10 +22,9 @@ public CheckServerRequest(String username, String serverID) { this.serverID = VerifyHelper.verifyServerID(serverID); } - public CheckServerRequest(String username, String serverID, String serverName, boolean needHardware, boolean needProperties) { + public CheckServerRequest(String username, String serverID, boolean needHardware, boolean needProperties) { this.username = username; - this.serverID = serverID; - this.serverName = serverName; + this.serverID = VerifyHelper.verifyServerID(serverID); this.needHardware = needHardware; this.needProperties = needProperties; } diff --git a/ServerWrapper/src/main/java/pro/gravit/launcher/server/ServerWrapper.java b/ServerWrapper/src/main/java/pro/gravit/launcher/server/ServerWrapper.java index c92f4caa..4b82b2a3 100644 --- a/ServerWrapper/src/main/java/pro/gravit/launcher/server/ServerWrapper.java +++ b/ServerWrapper/src/main/java/pro/gravit/launcher/server/ServerWrapper.java @@ -5,6 +5,7 @@ import pro.gravit.launcher.LauncherConfig; import pro.gravit.launcher.api.AuthService; import pro.gravit.launcher.api.ClientService; +import pro.gravit.launcher.api.ConfigService; import pro.gravit.launcher.api.KeyService; import pro.gravit.launcher.config.JsonConfigurable; import pro.gravit.launcher.events.request.AuthRequestEvent; @@ -68,6 +69,13 @@ public void restore() throws Exception { Request.addAllExtendedToken(config.extendedTokens); } Request.RequestRestoreReport report = Request.restore(config.oauth != null, false, false); + if(report.userInfo != null) { + if(report.userInfo.playerProfile != null) { + AuthService.username = report.userInfo.playerProfile.username; + AuthService.uuid = report.userInfo.playerProfile.uuid; + } + AuthService.permissions = report.userInfo.permissions; + } } public void getProfiles() throws Exception { @@ -80,6 +88,7 @@ public void getProfiles() throws Exception { this.serverProfile = srv; this.profile = p; Launcher.profile = p; + AuthService.profile = p; LogHelper.debug("Found profile: %s", Launcher.profile.getTitle()); isFound = true; break; @@ -199,6 +208,10 @@ public void run(String... args) throws Throwable { ClientService.classLoaderControl = classLoaderControl; ClientService.baseURLs = classLoaderControl.getURLs(); ClientService.nativePath = config.nativesDir; + ConfigService.serverName = config.serverName; + if(config.configServiceSettings != null) { + config.configServiceSettings.apply(); + } LogHelper.info("Start Minecraft Server"); LogHelper.debug("Invoke main method %s with %s", classname, launch.getClass().getName()); try { @@ -274,5 +287,17 @@ public static final class Config { public boolean enableHacks; public Map properties; + public ConfigServiceSettings configServiceSettings = new ConfigServiceSettings(); + + public static class ConfigServiceSettings { + public boolean disableLogging = false; + public boolean checkServerNeedProperties = false; + public boolean checkServerNeedHardware = false; + public void apply() { + ConfigService.disableLogging = disableLogging; + ConfigService.checkServerConfig.needHardware = checkServerNeedHardware; + ConfigService.checkServerConfig.needProperties = checkServerNeedProperties; + } + } } }