[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("\";");
}
public void setNettyAddress(String address) {
body.append("this.nettyAddress = \"");
body.append(address);
body.append("\";");
}
public void setProjectName(String name) {
body.append("this.projectname = \"");
body.append(name);
@ -89,18 +83,6 @@ public void setSecretKey(String key) {
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) {
int i = 2;
switch (env) {
@ -141,12 +123,6 @@ public void setDownloadJava(boolean b) {
body.append(";");
}
public void setNettyEnabled(boolean b) {
body.append("this.isNettyEnabled = ");
body.append(b ? "true" : "false");
body.append(";");
}
public void setWarningMissArchJava(boolean b) {
body.append("this.isWarningMissArchJava = ");
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);
server.buildHookManager.hook(context);
jaConfigurator.setAddress(server.config.getAddress());
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);
}
jaConfigurator.setAddress(server.config.netty.address);
if (server.config.guardLicense != null)
jaConfigurator.setGuardLicense(server.config.guardLicense.name, server.config.guardLicense.key, server.config.guardLicense.encryptKey);
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");
try {
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) {
e.printStackTrace();
}

View file

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

View file

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

View file

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

View file

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