diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java index 724d8a31..cdf8735c 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java @@ -1,7 +1,5 @@ package pro.gravit.launchserver; -import org.bouncycastle.crypto.util.PrivateKeyFactory; -import org.bouncycastle.operator.OperatorCreationException; import pro.gravit.launcher.Launcher; import pro.gravit.launcher.NeedGarbageCollection; import pro.gravit.launcher.hasher.HashedDir; @@ -38,9 +36,6 @@ import java.lang.invoke.MethodType; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; -import java.security.InvalidAlgorithmParameterException; -import java.security.KeyPair; -import java.security.NoSuchAlgorithmException; import java.security.interfaces.ECPrivateKey; import java.security.interfaces.ECPublicKey; import java.util.*; @@ -151,36 +146,6 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La featuresManager = new FeaturesManager(this); //Generate or set new Certificate API certificateManager.orgName = config.projectName; - /* - if (false) { - if (IOHelper.isFile(caCertFile) && IOHelper.isFile(caKeyFile)) { - certificateManager.ca = certificateManager.readCertificate(caCertFile); - certificateManager.caKey = certificateManager.readPrivateKey(caKeyFile); - } else { - try { - certificateManager.generateCA(); - certificateManager.writeCertificate(caCertFile, certificateManager.ca); - certificateManager.writePrivateKey(caKeyFile, certificateManager.caKey); - } catch (NoSuchAlgorithmException | InvalidAlgorithmParameterException | OperatorCreationException e) { - LogHelper.error(e); - } - } - if (IOHelper.isFile(serverCertFile) && IOHelper.isFile(serverKeyFile)) { - certificateManager.server = certificateManager.readCertificate(serverCertFile); - certificateManager.serverKey = certificateManager.readPrivateKey(serverKeyFile); - } else { - try { - KeyPair pair = certificateManager.generateKeyPair(); - certificateManager.server = certificateManager.generateCertificate(config.projectName.concat(" Server"), pair.getPublic()); - certificateManager.serverKey = PrivateKeyFactory.createKey(pair.getPrivate().getEncoded()); - certificateManager.writePrivateKey(serverKeyFile, pair.getPrivate()); - certificateManager.writeCertificate(serverCertFile, certificateManager.server); - } catch (InvalidAlgorithmParameterException | NoSuchAlgorithmException | OperatorCreationException e) { - LogHelper.error(e); - } - } - } - */ config.init(ReloadType.FULL); registerObject("launchServer", this); GarbageManager.registerNeedGC(sessionManager); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerBuilder.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerBuilder.java index b2d44a24..047bb607 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerBuilder.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerBuilder.java @@ -73,8 +73,6 @@ public LaunchServerBuilder setLaunchServerConfigManager(LaunchServer.LaunchServe } public LaunchServer build() throws Exception { - //if(updatesDir == null) updatesDir = dir.resolve("updates"); - //if(profilesDir == null) profilesDir = dir.resolve("profiles"); directories.collect(); if (launchServerConfigManager == null) { launchServerConfigManager = new LaunchServer.LaunchServerConfigManager() { diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java index a8e858b4..0c81d3f8 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java @@ -75,9 +75,6 @@ public static void main(String[] args) throws Exception { throw new IOException(e); } { - //LauncherTrustManager.CheckMode mode = (Version.RELEASE == Version.Type.LTS || Version.RELEASE == Version.Type.STABLE) ? - // (allowUnsigned ? LauncherTrustManager.CheckMode.WARN_IN_NOT_SIGNED : LauncherTrustManager.CheckMode.EXCEPTION_IN_NOT_SIGNED) : - // (allowUnsigned ? LauncherTrustManager.CheckMode.NONE_IN_NOT_SIGNED : LauncherTrustManager.CheckMode.WARN_IN_NOT_SIGNED); LauncherTrustManager.CheckClassResult result = certificateManager.checkClass(LaunchServer.class); if(result.type == LauncherTrustManager.CheckClassResultType.SUCCESS) { LogHelper.info("LaunchServer signed by %s", result.endCertificate.getSubjectDN().getName()); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MemoryHWIDProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MemoryHWIDProvider.java index 5cc24c5b..2024b458 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MemoryHWIDProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MemoryHWIDProvider.java @@ -23,7 +23,7 @@ public Map getCommands() { Map commands = new HashMap<>(); commands.put("hardwarelist", new SubCommand() { @Override - public void invoke(String... args) throws Exception { + public void invoke(String... args) { for (MemoryHWIDEntity e : db) { printHardwareInfo(LogHelper.Level.INFO, e.hardware); LogHelper.info("ID %d banned %s", e.id, e.banned ? "true" : "false"); @@ -74,7 +74,7 @@ public HardwareReportRequest.HardwareInfo findHardwareInfoByPublicKey(byte[] pub } @Override - public void createHardwareInfo(HardwareReportRequest.HardwareInfo hardwareInfo, byte[] publicKey, Client client) throws HWIDException { + public void createHardwareInfo(HardwareReportRequest.HardwareInfo hardwareInfo, byte[] publicKey, Client client) { db.add(new MemoryHWIDEntity(hardwareInfo, publicKey)); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java index 3dfa3e24..dd0d29e5 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java @@ -52,7 +52,7 @@ public HardwareReportRequest.HardwareInfo findHardwareInfoByPublicKey(byte[] pub if (set.next()) { if (set.getBoolean(11)) //isBanned { - throw new SecurityException("You HWID banned"); + throw new HWIDException("You HWID banned"); } long id = set.getLong(10); setUserHardwareId(connection, client.username, id); @@ -62,7 +62,7 @@ public HardwareReportRequest.HardwareInfo findHardwareInfoByPublicKey(byte[] pub } } catch (SQLException | IOException throwables) { LogHelper.error(throwables); - throw new SecurityException("SQL error. Please try again later"); + throw new HWIDException("SQL error. Please try again later"); } } @@ -104,7 +104,7 @@ public void createHardwareInfo(HardwareReportRequest.HardwareInfo hardwareInfo, } } catch (SQLException throwables) { LogHelper.error(throwables); - throw new SecurityException("SQL error. Please try again later"); + throw new HWIDException("SQL error. Please try again later"); } } @@ -120,7 +120,7 @@ public boolean addPublicKeyToHardwareInfo(HardwareReportRequest.HardwareInfo har if (result.compareLevel > criticalCompareLevel) { if (set.getBoolean(11)) //isBanned { - throw new SecurityException("You HWID banned"); + throw new HWIDException("You HWID banned"); } writeHwidLog(connection, id, publicKey); changePublicKey(connection, id, publicKey); @@ -130,7 +130,7 @@ public boolean addPublicKeyToHardwareInfo(HardwareReportRequest.HardwareInfo har } } catch (SQLException | IOException throwables) { LogHelper.error(throwables); - throw new SecurityException("SQL error. Please try again later"); + throw new HWIDException("SQL error. Please try again later"); } return false; } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/MemorySessionStorage.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/MemorySessionStorage.java index 0dc45db7..e7985ab6 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/MemorySessionStorage.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/MemorySessionStorage.java @@ -3,7 +3,6 @@ import pro.gravit.launcher.Launcher; import pro.gravit.launcher.NeedGarbageCollection; import pro.gravit.launchserver.LaunchServer; -import pro.gravit.launchserver.manangers.SessionManager; import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.LogHelper; @@ -158,7 +157,7 @@ public void garbageCollection() { } @Override - public void close() throws Exception { + public void close() { if(autoDump) { garbageCollection(); dumpSessionsData(); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/SessionStorage.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/SessionStorage.java index a1ac65e2..29c2fde4 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/SessionStorage.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/session/SessionStorage.java @@ -3,7 +3,6 @@ import pro.gravit.launchserver.LaunchServer; import pro.gravit.utils.ProviderMap; -import java.util.List; import java.util.UUID; import java.util.stream.Stream; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/PingServersCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/PingServersCommand.java index 1181391b..5872db32 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/PingServersCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/PingServersCommand.java @@ -21,7 +21,7 @@ public String getUsageDescription() { } @Override - public void invoke(String... args) throws Exception { + public void invoke(String... args) { server.pingServerManager.map.forEach((name, data) -> { LogHelper.info("[%s] online %d / %d", name, data.lastReport == null ? -1 : data.lastReport.playersOnline, data.lastReport == null ? -1 : data.lastReport.maxPlayers); if(data.lastReport != null && data.lastReport.users != null) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java index 30b83662..b8ff2666 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java @@ -31,7 +31,7 @@ public String getUsageDescription() { } @Override - public void invoke(String... args) throws Exception { + public void invoke(String... args) { LaunchServerConfig config = server.config; config.auth.forEach((name, pair) -> { if (pair.provider instanceof AcceptAuthProvider) { diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SignDirCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SignDirCommand.java index b6cbc886..70db681b 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SignDirCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SignDirCommand.java @@ -33,7 +33,7 @@ public void invoke(String... args) throws Exception { if (!IOHelper.isDir(targetDir)) throw new IllegalArgumentException(String.format("%s not directory", targetDir.toString())); Optional task = server.launcherBinary.getTaskByClass(SignJarTask.class); - if (!task.isPresent()) throw new IllegalStateException("SignJarTask not found"); + if (task.isEmpty()) throw new IllegalStateException("SignJarTask not found"); IOHelper.walk(targetDir, new SignJarVisitor(task.get()), true); LogHelper.info("Success signed"); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SignJarCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SignJarCommand.java index dc1e6c42..179d6eac 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SignJarCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SignJarCommand.java @@ -36,7 +36,7 @@ public void invoke(String... args) throws Exception { tmpSign = server.dir.resolve("build").resolve(target.toFile().getName()); LogHelper.info("Signing jar %s to %s", target.toString(), tmpSign.toString()); Optional task = server.launcherBinary.getTaskByClass(SignJarTask.class); - if (!task.isPresent()) throw new IllegalStateException("SignJarTask not found"); + if (task.isEmpty()) throw new IllegalStateException("SignJarTask not found"); task.get().sign(server.config.sign, target, tmpSign); if (args.length <= 1) { LogHelper.info("Move temp jar %s to %s", tmpSign.toString(), target.toString()); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/dao/provider/HibernateDaoProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/dao/provider/HibernateDaoProvider.java index bae109bd..d7ce76e3 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/dao/provider/HibernateDaoProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/dao/provider/HibernateDaoProvider.java @@ -60,7 +60,7 @@ public Map getCommands() { Map commands = new HashMap<>(); commands.put("getallusers", new SubCommand() { @Override - public void invoke(String... args) throws Exception { + public void invoke(String... args) { int count = 0; for (User user : userDAO.findAll()) { LogHelper.subInfo("[%s] UUID: %s", user.getUsername(), user.getUuid().toString()); @@ -119,7 +119,7 @@ public void invoke(String... args) throws Exception { } @Override - public void close() throws Exception { + public void close() { sessionFactory.close(); } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/helper/SignHelper.java b/LaunchServer/src/main/java/pro/gravit/launchserver/helper/SignHelper.java index 78374ce5..d2f16da1 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/helper/SignHelper.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/helper/SignHelper.java @@ -138,7 +138,7 @@ public HashingNonClosingOutputStream(OutputStream out, MessageDigest hasher) { } @Override - public void close() throws IOException { + public void close() { // Do nothing } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/launchermodules/LauncherModuleLoader.java b/LaunchServer/src/main/java/pro/gravit/launchserver/launchermodules/LauncherModuleLoader.java index d0bf6847..1a4d980f 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/launchermodules/LauncherModuleLoader.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/launchermodules/LauncherModuleLoader.java @@ -119,15 +119,6 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO targetConfig = Launcher.gsonManager.configGson.fromJson(reader, clazz); } } - //Field[] fields = clazz.getFields(); - //for (Field field : fields) { - // if ((field.getModifiers() & Modifier.STATIC) != 0) continue; - // Object obj = field.get(targetConfig); - // String configPropertyName = "modules.".concat(entity.moduleConfigName.toLowerCase()).concat(".").concat(field.getName().toLowerCase()); - // if (entity.propertyMap == null) entity.propertyMap = new HashMap<>(); - // LogHelper.dev("Property name %s", configPropertyName); - // entity.propertyMap.put(configPropertyName, obj); - //} if (entity.propertyMap == null) entity.propertyMap = new HashMap<>(); addClassFieldsToProperties(entity.propertyMap, "modules.".concat(entity.moduleConfigName.toLowerCase()), targetConfig, clazz); } catch (Throwable e) { diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/MirrorManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/MirrorManager.java index 137c28ab..c3dbe1ab 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/MirrorManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/MirrorManager.java @@ -104,8 +104,6 @@ public static class Mirror { boolean enabled; Mirror(String url) { - //assetsURLMask = url.concat("assets/%s.zip"); - //clientsURLMask = url.concat("clients/%s.zip"); baseUrl = url; } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/SessionManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/SessionManager.java index 3dd5bf48..920fc465 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/SessionManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/SessionManager.java @@ -6,11 +6,9 @@ import pro.gravit.launchserver.auth.RequiredDAO; import pro.gravit.launchserver.socket.Client; import pro.gravit.utils.HookSet; -import pro.gravit.utils.helper.LogHelper; import java.nio.charset.StandardCharsets; import java.util.*; -import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Stream; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/LauncherNettyServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/LauncherNettyServer.java index a68169df..25393a64 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/LauncherNettyServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/LauncherNettyServer.java @@ -80,7 +80,5 @@ public ChannelFuture bind(InetSocketAddress address) { public void close() { workerGroup.shutdownGracefully(2, 5, TimeUnit.SECONDS); bossGroup.shutdownGracefully(2, 5, TimeUnit.SECONDS); - //workerGroup.shutdownGracefully(); - //bossGroup.shutdownGracefully(); } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/WebSocketService.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/WebSocketService.java index abe90139..24149cac 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/WebSocketService.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/WebSocketService.java @@ -66,9 +66,6 @@ public class WebSocketService { public WebSocketService(ChannelGroup channels, LaunchServer server) { this.channels = channels; this.server = server; - //this.gsonBuiler.registerTypeAdapter(WebSocketServerResponse.class, new JsonResponseAdapter(this)); - //this.gsonBuiler.registerTypeAdapter(WebSocketEvent.class, new JsonResultSerializeAdapter()); - //this.gsonBuiler.registerTypeAdapter(HashedEntry.class, new HashedEntryAdapter()); this.gson = Launcher.gsonManager.gson; } @@ -78,7 +75,7 @@ public void forEachActiveChannels(BiConsumer cal WebSocketFrameHandler wsHandler = channel.pipeline().get(WebSocketFrameHandler.class); if (wsHandler == null) continue; callback.accept(channel, wsHandler); - }; + } } public static void registerResponses() { diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyServerSocketHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyServerSocketHandler.java index 79e78fb7..f239d548 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyServerSocketHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyServerSocketHandler.java @@ -30,71 +30,10 @@ public void close() { @Override public void run() { - /*SSLContext sc = null; - try { - sc = SSLContextInit(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (UnrecoverableKeyException e) { - e.printStackTrace(); - } catch (KeyStoreException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (CertificateException e) { - e.printStackTrace(); - }*/ - //System.setProperty( "javax.net.ssl.keyStore","keystore"); - //System.setProperty( "javax.net.ssl.keyStorePassword","PSP1000"); - /*try { - Selector selector = Selector.open(); - ServerSocketChannel serverChannel = ServerSocketChannel.open(); - serverChannel.configureBlocking(false); - } catch (IOException e) { - e.printStackTrace(); - }*/ LogHelper.info("Starting netty server socket thread"); - //SSLEngine engine = sc.createSSLEngine(); - //engine.setUseClientMode(false); nettyServer = new LauncherNettyServer(server); for (LaunchServerConfig.NettyBindAddress address : server.config.netty.binds) { nettyServer.bind(new InetSocketAddress(address.address, address.port)); } - /* - try (SSLServerSocket serverSocket = (SSLServerSocket) ssf.createServerSocket()) { - serverSocket.setEnabledProtocols(new String[] {"TLSv1.2"}); - if (!this.serverSocket.compareAndSet(null, serverSocket)) { - throw new IllegalStateException("Previous socket wasn't closed"); - } - - // Set socket params - serverSocket.setReuseAddress(true); - serverSocket.setPerformancePreferences(1, 0, 2); - //serverSocket.setReceiveBufferSize(0x10000); - serverSocket.bind(server.config.getSocketAddress()); - LogHelper.info("Server socket thread successfully started"); - // Listen for incoming connections - while (serverSocket.isBound()) { - SSLSocket socket = (SSLSocket) serverSocket.accept(); - sockets.add(socket); - socket.startHandshake(); - // Invoke pre-connect listener - long id = idCounter.incrementAndGet(); - if (listener != null && !listener.onConnect(id, socket.getInetAddress())) { - continue; // Listener didn't accepted this connection - } - - // Reply in separate thread - threadPool.execute(new ResponseThread(server, id, socket)); - } - } catch (IOException e) { - // Ignore error after close/rebind - if (serverSocket.get() != null) { - LogHelper.error(e); - } - } - */ } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/AuthResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/AuthResponse.java index 6fd35b41..1ea89786 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/AuthResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/AuthResponse.java @@ -80,9 +80,6 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti AuthProvider.authError(String.format("Illegal result: '%s'", aresult.username)); return; } - //if (clientData.profile == null) { - // throw new AuthException("You profile not found"); - //} server.authHookManager.postHook.hook(context, clientData); clientData.isAuth = true; clientData.permissions = aresult.permissions; 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 1a32823e..272efcf5 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 @@ -20,7 +20,7 @@ public String getType() { } @Override - public void execute(ChannelHandlerContext ctx, Client client) throws Exception { + public void execute(ChannelHandlerContext ctx, Client client) { if (username != null && (!client.isAuth || client.permissions == null || !client.permissions.isPermission(ClientPermissions.PermissionConsts.ADMIN))) { sendError("Permissions denied"); return; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/FeaturesResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/FeaturesResponse.java index 09eb4118..74ccf493 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/FeaturesResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/FeaturesResponse.java @@ -12,7 +12,7 @@ public String getType() { } @Override - public void execute(ChannelHandlerContext ctx, Client client) throws Exception { + public void execute(ChannelHandlerContext ctx, Client client) { sendResult(new FeaturesRequestEvent(server.featuresManager.getMap())); } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerReportResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerReportResponse.java index e44c7bfd..e2bcd34f 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerReportResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerReportResponse.java @@ -17,7 +17,7 @@ public String getType() { } @Override - public void execute(ChannelHandlerContext ctx, Client client) throws Exception { + public void execute(ChannelHandlerContext ctx, Client client) { if (!client.isAuth || client.permissions == null || !client.permissions.isPermission(ClientPermissions.PermissionConsts.MANAGEMENT)) { sendError("Access denied"); return; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerResponse.java index c1281a16..2917a938 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/PingServerResponse.java @@ -20,7 +20,7 @@ public String getType() { } @Override - public void execute(ChannelHandlerContext ctx, Client client) throws Exception { + public void execute(ChannelHandlerContext ctx, Client client) { Map map = new HashMap<>(); if (serverNames == null) { server.pingServerManager.map.forEach((name, entity) -> { diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/ServerStatusResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/ServerStatusResponse.java index 4eb8939e..53108a26 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/ServerStatusResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/management/ServerStatusResponse.java @@ -13,7 +13,7 @@ public String getType() { } @Override - public void execute(ChannelHandlerContext ctx, Client client) throws Exception { + public void execute(ChannelHandlerContext ctx, Client client) { ServerStatusRequestEvent event = new ServerStatusRequestEvent(server.config.projectName); event.totalJavaMemory = JVMHelper.RUNTIME.totalMemory(); event.freeJavaMemory = JVMHelper.RUNTIME.freeMemory(); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/GetSecureLevelInfoResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/GetSecureLevelInfoResponse.java index 91925012..26a04b32 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/GetSecureLevelInfoResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/GetSecureLevelInfoResponse.java @@ -13,7 +13,7 @@ public String getType() { } @Override - public void execute(ChannelHandlerContext ctx, Client client) throws Exception { + public void execute(ChannelHandlerContext ctx, Client client) { if (!(server.config.protectHandler instanceof SecureProtectHandler)) { GetSecureLevelInfoRequestEvent response = new GetSecureLevelInfoRequestEvent(null); response.enabled = false; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/HardwareReportResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/HardwareReportResponse.java index 501ba310..e436d775 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/HardwareReportResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/HardwareReportResponse.java @@ -16,7 +16,7 @@ public String getType() { } @Override - public void execute(ChannelHandlerContext ctx, Client client) throws Exception { + public void execute(ChannelHandlerContext ctx, Client client) { if (server.config.protectHandler instanceof HardwareProtectHandler) { try { ((HardwareProtectHandler) server.config.protectHandler).onHardwareReport(this, client); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/SecurityReportResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/SecurityReportResponse.java index 3e47b09a..21e931a6 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/SecurityReportResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/SecurityReportResponse.java @@ -20,7 +20,7 @@ public String getType() { } @Override - public void execute(ChannelHandlerContext ctx, Client client) throws Exception { + public void execute(ChannelHandlerContext ctx, Client client) { if (!(server.config.protectHandler instanceof SecureProtectHandler)) { sendError("Method not allowed"); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/VerifySecureLevelKeyResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/VerifySecureLevelKeyResponse.java index d289c4f0..94c8021a 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/VerifySecureLevelKeyResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/secure/VerifySecureLevelKeyResponse.java @@ -18,7 +18,7 @@ public String getType() { } @Override - public void execute(ChannelHandlerContext ctx, Client client) throws Exception { + public void execute(ChannelHandlerContext ctx, Client client) { if (!(server.config.protectHandler instanceof SecureProtectHandler) || client.trustLevel == null || client.trustLevel.verifySecureKey == null) { sendError("This method not allowed"); return; diff --git a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java index 317fab67..a14e04a0 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java +++ b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java @@ -136,7 +136,9 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep } args.add(MAGIC_ARG); args.add("-XX:+DisableAttachMechanism"); - args.add("-Xmx256M"); + if(launcherMemoryLimit != 0) { + args.add(String.format("-Xmx%dM", launcherMemoryLimit)); + } //Collections.addAll(args, "-javaagent:".concat(pathLauncher)); args.add("-cp"); args.add(pathLauncher);