diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java b/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java index c916c8b7..037c541f 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java @@ -87,7 +87,7 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException @LauncherAPI public LauncherConfig(String address, ECPublicKey publicKey, Map runtime, String projectName) { this.address = address; - this.publicKey = Objects.requireNonNull(publicKey, "publicKey"); + this.publicKey = publicKey; this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime)); this.projectName = projectName; this.clientPort = 32148; 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 a6ea4409..365f6eeb 100644 --- a/ServerWrapper/src/main/java/pro/gravit/launcher/server/ServerWrapper.java +++ b/ServerWrapper/src/main/java/pro/gravit/launcher/server/ServerWrapper.java @@ -27,6 +27,7 @@ import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; +import java.security.interfaces.ECPublicKey; import java.security.spec.InvalidKeySpecException; import java.util.Arrays; import java.util.HashMap; @@ -190,7 +191,10 @@ public void updateLauncherConfig() { LauncherConfig cfg = null; try { - cfg = new LauncherConfig(config.address, SecurityHelper.toPublicECKey(IOHelper.read(publicKeyFile)), new HashMap<>(), config.projectname); + ECPublicKey publicKey = null; + if(IOHelper.isFile(publicKeyFile)) + publicKey = SecurityHelper.toPublicECKey(IOHelper.read(publicKeyFile)); + cfg = new LauncherConfig(config.address, publicKey, new HashMap<>(), config.projectname); cfg.isNettyEnabled = true; cfg.address = config.address; } catch (InvalidKeySpecException | IOException e) { diff --git a/ServerWrapper/src/main/java/pro/gravit/launcher/server/setup/ServerWrapperSetup.java b/ServerWrapper/src/main/java/pro/gravit/launcher/server/setup/ServerWrapperSetup.java index 12cbf82e..79c940b7 100644 --- a/ServerWrapper/src/main/java/pro/gravit/launcher/server/setup/ServerWrapperSetup.java +++ b/ServerWrapper/src/main/java/pro/gravit/launcher/server/setup/ServerWrapperSetup.java @@ -46,16 +46,6 @@ public void run() throws IOException { String address = commands.commandHandler.readLine(); wrapper.config.mainclass = mainClassName; wrapper.config.address = address; - if (!Files.exists(ServerWrapper.publicKeyFile)) { - LogHelper.error("public.key not found"); - for (int i = 0; i < 10; ++i) { - System.out.println("Print F to continue:"); - String printF = commands.commandHandler.readLine(); - if (printF.equals("stop")) return; - if (Files.exists(ServerWrapper.publicKeyFile)) break; - else LogHelper.error("public.key not found"); - } - } boolean stopOnError = wrapper.config.stopOnError; for (int i = 0; i < 10; ++i) { System.out.println("Print server account login:");