mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[REFRACTOR] Чистка LauncherConfig от кода старого протокола
This commit is contained in:
parent
c1903428eb
commit
902936ddd7
7 changed files with 7 additions and 47 deletions
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ public static void initWebSockets(String address) {
|
|||
}
|
||||
|
||||
static {
|
||||
if (Launcher.getConfig().nettyPort != 0)
|
||||
initWebSockets(Launcher.getConfig().nettyAddress);
|
||||
initWebSockets(Launcher.getConfig().address);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue