[REFRACTOR] Чистка LauncherConfig от кода старого протокола

This commit is contained in:
Gravit 2019-04-04 19:02:12 +07:00
parent c1903428eb
commit 902936ddd7
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
7 changed files with 7 additions and 47 deletions

View file

@ -71,12 +71,6 @@ public void setAddress(String address) {
body.append("\";"); body.append("\";");
} }
public void setNettyAddress(String address) {
body.append("this.nettyAddress = \"");
body.append(address);
body.append("\";");
}
public void setProjectName(String name) { public void setProjectName(String name) {
body.append("this.projectname = \""); body.append("this.projectname = \"");
body.append(name); body.append(name);
@ -89,18 +83,6 @@ public void setSecretKey(String key) {
body.append("\";"); body.append("\";");
} }
public void setPort(int port) {
body.append("this.port = ");
body.append(port);
body.append(";");
}
public void setNettyPort(int port) {
body.append("this.nettyPort = ");
body.append(port);
body.append(";");
}
public void setEnv(LauncherConfig.LauncherEnvironment env) { public void setEnv(LauncherConfig.LauncherEnvironment env) {
int i = 2; int i = 2;
switch (env) { switch (env) {
@ -141,12 +123,6 @@ public void setDownloadJava(boolean b) {
body.append(";"); body.append(";");
} }
public void setNettyEnabled(boolean b) {
body.append("this.isNettyEnabled = ");
body.append(b ? "true" : "false");
body.append(";");
}
public void setWarningMissArchJava(boolean b) { public void setWarningMissArchJava(boolean b) {
body.append("this.isWarningMissArchJava = "); body.append("this.isWarningMissArchJava = ");
body.append(b ? "true" : "false"); body.append(b ? "true" : "false");

View file

@ -128,13 +128,7 @@ public Path process(Path inputJar) throws IOException {
}); });
BuildContext context = new BuildContext(output, jaConfigurator, this); BuildContext context = new BuildContext(output, jaConfigurator, this);
server.buildHookManager.hook(context); server.buildHookManager.hook(context);
jaConfigurator.setAddress(server.config.getAddress()); jaConfigurator.setAddress(server.config.netty.address);
jaConfigurator.setPort(server.config.port);
jaConfigurator.setNettyEnabled(server.config.netty.clientEnabled);
if (server.config.netty.clientEnabled) {
jaConfigurator.setNettyPort(server.config.netty.port);
jaConfigurator.setNettyAddress(server.config.netty.address);
}
if (server.config.guardLicense != null) if (server.config.guardLicense != null)
jaConfigurator.setGuardLicense(server.config.guardLicense.name, server.config.guardLicense.key, server.config.guardLicense.encryptKey); jaConfigurator.setGuardLicense(server.config.guardLicense.name, server.config.guardLicense.key, server.config.guardLicense.encryptKey);
jaConfigurator.setProjectName(server.config.projectName); jaConfigurator.setProjectName(server.config.projectName);

View file

@ -477,7 +477,7 @@ public static void main(String... args) throws Throwable {
LogHelper.debug("WebSocket connect closed. Try reconnect"); LogHelper.debug("WebSocket connect closed. Try reconnect");
try { try {
if (!LegacyRequestBridge.service.reconnectBlocking()) LogHelper.error("Error connecting"); if (!LegacyRequestBridge.service.reconnectBlocking()) LogHelper.error("Error connecting");
LogHelper.debug("Connect to %s", Launcher.getConfig().nettyAddress); LogHelper.debug("Connect to %s", Launcher.getConfig().address);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }

View file

@ -55,7 +55,6 @@ public static void initWebSockets(String address) {
} }
static { static {
if (Launcher.getConfig().nettyPort != 0) initWebSockets(Launcher.getConfig().address);
initWebSockets(Launcher.getConfig().nettyAddress);
} }
} }

View file

@ -203,8 +203,7 @@ public void updateLauncherConfig() {
if(config.websocket != null && config.websocket.enabled) if(config.websocket != null && config.websocket.enabled)
{ {
cfg.isNettyEnabled = true; cfg.isNettyEnabled = true;
cfg.nettyAddress = config.websocket.address; cfg.address = config.websocket.address;
cfg.nettyPort = 1111;
} }
} catch (InvalidKeySpecException | IOException e) { } catch (InvalidKeySpecException | IOException e) {
LogHelper.error(e); LogHelper.error(e);

View file

@ -3,15 +3,11 @@
public class AutogenConfig { public class AutogenConfig {
public String projectname; public String projectname;
public String address; public String address;
public String nettyAddress;
public int port;
public int nettyPort;
public int clientPort; public int clientPort;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private boolean isInitModules; private boolean isInitModules;
public boolean isUsingWrapper; public boolean isUsingWrapper;
public boolean isDownloadJava; //Выставление этого флага требует модификации runtime части public boolean isDownloadJava; //Выставление этого флага требует модификации runtime части
public boolean isNettyEnabled;
public String secretKeyClient; public String secretKeyClient;
public String guardLicenseName; public String guardLicenseName;
public String guardLicenseKey; public String guardLicenseKey;

View file

@ -20,8 +20,7 @@ public static AutogenConfig getAutogenConfig() {
} }
// Instance // Instance
public String nettyAddress; public String address;
public int nettyPort;
@LauncherAPI @LauncherAPI
public final String projectname; public final String projectname;
public final int clientPort; public final int clientPort;
@ -53,9 +52,6 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
guardLicenseEncryptKey = config.guardLicenseEncryptKey; guardLicenseEncryptKey = config.guardLicenseEncryptKey;
guardLicenseKey = config.guardLicenseKey; guardLicenseKey = config.guardLicenseKey;
guardLicenseName = config.guardLicenseName; guardLicenseName = config.guardLicenseName;
nettyPort = config.nettyPort;
nettyAddress = config.nettyAddress;
isNettyEnabled = config.isNettyEnabled;
LauncherEnvironment env; LauncherEnvironment env;
if (config.env == 0) env = LauncherEnvironment.DEV; if (config.env == 0) env = LauncherEnvironment.DEV;
else if (config.env == 1) env = LauncherEnvironment.DEBUG; else if (config.env == 1) env = LauncherEnvironment.DEBUG;
@ -77,7 +73,7 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
@LauncherAPI @LauncherAPI
public LauncherConfig(String address, RSAPublicKey publicKey, Map<String, byte[]> runtime, String projectname) { public LauncherConfig(String address, RSAPublicKey publicKey, Map<String, byte[]> runtime, String projectname) {
this.nettyAddress = address; this.address = address;
this.publicKey = Objects.requireNonNull(publicKey, "publicKey"); this.publicKey = Objects.requireNonNull(publicKey, "publicKey");
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime)); this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
this.projectname = projectname; this.projectname = projectname;
@ -93,7 +89,7 @@ public LauncherConfig(String address, RSAPublicKey publicKey, Map<String, byte[]
@LauncherAPI @LauncherAPI
public LauncherConfig(String address, RSAPublicKey publicKey, Map<String, byte[]> runtime) { public LauncherConfig(String address, RSAPublicKey publicKey, Map<String, byte[]> runtime) {
this.nettyAddress = address; this.address = address;
this.publicKey = Objects.requireNonNull(publicKey, "publicKey"); this.publicKey = Objects.requireNonNull(publicKey, "publicKey");
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime)); this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
this.projectname = "Minecraft"; this.projectname = "Minecraft";