mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-24 11:16:05 +01:00
Update GalaxiEngine (again)
This update removes string unescaping from ObjectMap. This will surely fix a ton of yet unfound bugs that exist from us simply picking the wrong method.
This commit is contained in:
parent
86471491bd
commit
92151d75d0
@ -28,7 +28,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiUtil</artifactId>
|
||||
<version>21w44a</version>
|
||||
<version>21w44b</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -34,7 +34,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ME1312.SubData</groupId>
|
||||
<artifactId>Server</artifactId>
|
||||
<version>21w43a</version>
|
||||
<version>21w44a</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -74,9 +74,9 @@ public class ExternalSubCreator extends SubCreator {
|
||||
try {
|
||||
if (file.isDirectory() && !file.getName().endsWith(".x")) {
|
||||
ObjectMap<String> config = (new File(file, "template.yml").exists())? new YAMLConfig(new File(file, "template.yml")).get().getMap("Template", new ObjectMap<String>()) : new ObjectMap<String>();
|
||||
ServerTemplate template = loadTemplate(file.getName(), config.getBoolean("Enabled", true), config.getBoolean("Internal", false), config.getRawString("Icon", "::NULL::"), file, config.getMap("Build", new ObjectMap<String>()), config.getMap("Settings", new ObjectMap<String>()));
|
||||
ServerTemplate template = loadTemplate(file.getName(), config.getBoolean("Enabled", true), config.getBoolean("Internal", false), config.getString("Icon", "::NULL::"), file, config.getMap("Build", new ObjectMap<String>()), config.getMap("Settings", new ObjectMap<String>()));
|
||||
templatesR.put(file.getName().toLowerCase(), template);
|
||||
if (config.getKeys().contains("Display")) template.setDisplayName(config.getString("Display"));
|
||||
if (config.getKeys().contains("Display")) template.setDisplayName(Util.unescapeJavaString(config.getString("Display")));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.get(host.getName()).severe("Couldn't load template: " + file.getName());
|
||||
@ -205,13 +205,13 @@ public class ExternalSubCreator extends SubCreator {
|
||||
server.setAll(config);
|
||||
|
||||
if (update != null) Try.all.run(() -> update.getHost().forceRemoveSubServer(name));
|
||||
subserver = host.constructSubServer(name, server.getBoolean("Enabled"), port, ChatColor.translateAlternateColorCodes('&', server.getString("Motd")), server.getBoolean("Log"),
|
||||
server.getRawString("Directory"), server.getRawString("Executable"), server.getRawString("Stop-Command"), server.getBoolean("Hidden"), server.getBoolean("Restricted"));
|
||||
subserver = host.constructSubServer(name, server.getBoolean("Enabled"), port, ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(server.getString("Motd"))), server.getBoolean("Log"),
|
||||
server.getString("Directory"), server.getString("Executable"), server.getString("Stop-Command"), server.getBoolean("Hidden"), server.getBoolean("Restricted"));
|
||||
|
||||
if (server.getString("Display").length() > 0) subserver.setDisplayName(server.getString("Display"));
|
||||
subserver.setTemplate(server.getRawString("Template"));
|
||||
if (server.getString("Display").length() > 0) subserver.setDisplayName(Util.unescapeJavaString(server.getString("Display")));
|
||||
subserver.setTemplate(server.getString("Template"));
|
||||
for (String group : server.getStringList("Group")) subserver.addGroup(group);
|
||||
SubServer.StopAction action = Try.all.get(() -> SubServer.StopAction.valueOf(server.getRawString("Stop-Action").toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
SubServer.StopAction action = Try.all.get(() -> SubServer.StopAction.valueOf(server.getString("Stop-Action").toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
if (action != null) subserver.setStopAction(action);
|
||||
if (server.contains("Extra")) for (String extra : server.getMap("Extra").getKeys())
|
||||
subserver.addExtra(extra, server.getMap("Extra").getObject(extra));
|
||||
|
@ -250,7 +250,7 @@ public class ExternalSubServer extends SubServerImpl {
|
||||
switch (key.toLowerCase()) {
|
||||
case "name":
|
||||
if (value.isString() && host.removeSubServer(player, getName())) {
|
||||
SubServer server = host.constructSubServer(value.asRawString(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), getPath(), getExecutable(), getStopCommand(), isHidden(), isRestricted());
|
||||
SubServer server = host.constructSubServer(value.asString(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), getPath(), getExecutable(), getStopCommand(), isHidden(), isRestricted());
|
||||
if (server != null) {
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
ObjectMap<String> config = this.host.plugin.servers.get().getMap("Servers").getMap(getName());
|
||||
@ -265,7 +265,7 @@ public class ExternalSubServer extends SubServerImpl {
|
||||
break;
|
||||
case "display":
|
||||
if (value.isString()) {
|
||||
setDisplayName(value.asRawString());
|
||||
setDisplayName(value.asString());
|
||||
logger.name = getDisplayName();
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
if (getName().equals(getDisplayName())) {
|
||||
@ -302,7 +302,7 @@ public class ExternalSubServer extends SubServerImpl {
|
||||
case "host":
|
||||
if (value.isString() && host.removeSubServer(player, getName())) {
|
||||
waitFor(() -> host.getSubServer(getName()), null);
|
||||
SubServer server = this.host.plugin.api.getHost(value.asRawString()).constructSubServer(getName(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), getPath(), getExecutable(), getStopCommand(), isHidden(), isRestricted());
|
||||
SubServer server = this.host.plugin.api.getHost(value.asString()).constructSubServer(getName(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), getPath(), getExecutable(), getStopCommand(), isHidden(), isRestricted());
|
||||
if (server != null) {
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Host", server.getHost().getName());
|
||||
@ -315,7 +315,7 @@ public class ExternalSubServer extends SubServerImpl {
|
||||
break;
|
||||
case "template":
|
||||
if (value.isString()) {
|
||||
setTemplate(value.asRawString());
|
||||
setTemplate(value.asString());
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Template", value.asString());
|
||||
this.host.plugin.servers.save();
|
||||
@ -339,7 +339,7 @@ public class ExternalSubServer extends SubServerImpl {
|
||||
break;
|
||||
case "motd":
|
||||
if (value.isString()) {
|
||||
setMotd(ChatColor.translateAlternateColorCodes('&', value.asString()));
|
||||
setMotd(ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(value.asString())));
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Motd", value.asString());
|
||||
this.host.plugin.servers.save();
|
||||
@ -362,7 +362,7 @@ public class ExternalSubServer extends SubServerImpl {
|
||||
case "directory":
|
||||
if (value.isString() && host.removeSubServer(player, getName())) {
|
||||
waitFor(() -> host.getSubServer(getName()), null);
|
||||
SubServer server = host.constructSubServer(getName(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), value.asRawString(), getExecutable(), getStopCommand(), isHidden(), isRestricted());
|
||||
SubServer server = host.constructSubServer(getName(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), value.asString(), getExecutable(), getStopCommand(), isHidden(), isRestricted());
|
||||
if (server != null) {
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Directory", server.getPath());
|
||||
@ -377,10 +377,10 @@ public class ExternalSubServer extends SubServerImpl {
|
||||
case "executable":
|
||||
if (value.isString() && host.removeSubServer(player, getName())) {
|
||||
waitFor(() -> host.getSubServer(getName()), null);
|
||||
SubServer server = host.constructSubServer(getName(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), getPath(), value.asRawString(), getStopCommand(), isHidden(), isRestricted());
|
||||
SubServer server = host.constructSubServer(getName(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), getPath(), value.asString(), getStopCommand(), isHidden(), isRestricted());
|
||||
if (server != null) {
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Executable", value.asRawString());
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Executable", value.asString());
|
||||
this.host.plugin.servers.save();
|
||||
}
|
||||
forward = server;
|
||||
@ -396,8 +396,8 @@ public class ExternalSubServer extends SubServerImpl {
|
||||
case "stop-cmd":
|
||||
case "stop-command":
|
||||
if (value.isString()) {
|
||||
if (!stopcmd.equals(value.asRawString())) host.queue(new PacketExControlServer(this, Action.SET_STOP_COMMAND, value.asRawString()));
|
||||
stopcmd = value.asRawString();
|
||||
if (!stopcmd.equals(value.asString())) host.queue(new PacketExControlServer(this, Action.SET_STOP_COMMAND, value.asString()));
|
||||
stopcmd = value.asString();
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Stop-Command", getStopCommand());
|
||||
this.host.plugin.servers.save();
|
||||
@ -407,7 +407,7 @@ public class ExternalSubServer extends SubServerImpl {
|
||||
break;
|
||||
case "stop-action":
|
||||
if (value.isString()) {
|
||||
StopAction action = Try.all.get(() -> StopAction.valueOf(value.asRawString().toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
StopAction action = Try.all.get(() -> StopAction.valueOf(value.asString().toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
if (action != null) {
|
||||
stopaction = action;
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
|
@ -133,7 +133,7 @@ public class InternalSubCreator extends SubCreator {
|
||||
updateDirectory(template.getDirectory(), dir, template.getBuildOptions().getBoolean("Update-Files", false));
|
||||
|
||||
for (ObjectMapValue<String> replacement : template.getBuildOptions().getMap("Replacements", new ObjectMap<>()).getValues()) if (!replacement.isNull()) {
|
||||
replacements.put(replacement.getHandle().toLowerCase().replace('-', '_').replace(' ', '_'), replacement.asRawString());
|
||||
replacements.put(replacement.getHandle().toLowerCase().replace('-', '_').replace(' ', '_'), replacement.asString());
|
||||
}
|
||||
|
||||
var.putAll(replacements);
|
||||
@ -159,9 +159,9 @@ public class InternalSubCreator extends SubCreator {
|
||||
ObjectMap<String> spprofile = null;
|
||||
Version spversion = null;
|
||||
for (ObjectMap<String> profile : spversionmanifest.getMapList("versions")) {
|
||||
if (profile.getMap("dependencies").getRawString("minecraft").equalsIgnoreCase(version.toString()) && (spversion == null || new Version(profile.getRawString("version")).compareTo(spversion) >= 0)) {
|
||||
if (profile.getMap("dependencies").getString("minecraft").equalsIgnoreCase(version.toString()) && (spversion == null || new Version(profile.getString("version")).compareTo(spversion) >= 0)) {
|
||||
spprofile = profile;
|
||||
spversion = new Version(profile.getRawString("version"));
|
||||
spversion = new Version(profile.getString("version"));
|
||||
}
|
||||
}
|
||||
if (spversion == null)
|
||||
@ -169,7 +169,7 @@ public class InternalSubCreator extends SubCreator {
|
||||
log.log(INFO, "Found \"sponge" + ((template.getType() == ServerType.FORGE)?"forge":"vanilla") + "-" + spversion.toString() + '"');
|
||||
|
||||
if (template.getType() == ServerType.FORGE) {
|
||||
Version mcfversion = new Version(((spprofile.getMap("dependencies").getRawString("forge").contains("-"))?"":spprofile.getMap("dependencies").getRawString("minecraft") + '-') + spprofile.getMap("dependencies").getRawString("forge"));
|
||||
Version mcfversion = new Version(((spprofile.getMap("dependencies").getString("forge").contains("-"))?"":spprofile.getMap("dependencies").getString("minecraft") + '-') + spprofile.getMap("dependencies").getString("forge"));
|
||||
log.log(INFO, "Found \"forge-" + mcfversion.toString() + '"');
|
||||
|
||||
var.put("mcf_version", mcfversion.toString());
|
||||
@ -193,7 +193,7 @@ public class InternalSubCreator extends SubCreator {
|
||||
|
||||
try {
|
||||
log.log(INFO, "Launching Build Script...");
|
||||
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(gitBash, template.getBuildOptions().getRawString("Executable"))).directory(dir);
|
||||
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(gitBash, template.getBuildOptions().getString("Executable"))).directory(dir);
|
||||
pb.environment().putAll(var);
|
||||
log.file = new File(dir, "SubCreator-" + template.getName() + ((version != null)?"-"+version.toString():"") + ".log");
|
||||
process = pb.start();
|
||||
@ -239,7 +239,7 @@ public class InternalSubCreator extends SubCreator {
|
||||
|
||||
declaration.run();
|
||||
File dir = (update != null)?new File(update.getFullPath()):new File(host.getPath(),
|
||||
(template.getConfigOptions().contains("Directory"))?new ReplacementScanner(replacements).replace(template.getConfigOptions().getRawString("Directory")).toString():name);
|
||||
(template.getConfigOptions().contains("Directory"))?new ReplacementScanner(replacements).replace(template.getConfigOptions().getString("Directory")).toString():name);
|
||||
|
||||
ObjectMap<String> server = new ObjectMap<String>();
|
||||
ObjectMap<String> config;
|
||||
@ -263,7 +263,7 @@ public class InternalSubCreator extends SubCreator {
|
||||
|
||||
LinkedList<String> masks = new LinkedList<>();
|
||||
masks.add("/server.properties");
|
||||
masks.addAll(template.getBuildOptions().getRawStringList("Replace", Collections.emptyList()));
|
||||
masks.addAll(template.getBuildOptions().getStringList("Replace", Collections.emptyList()));
|
||||
replacements.replace(dir, masks.toArray(new String[0]));
|
||||
} catch (Exception e) {
|
||||
config = null;
|
||||
@ -306,13 +306,13 @@ public class InternalSubCreator extends SubCreator {
|
||||
server.setAll(config);
|
||||
|
||||
if (update != null) Try.all.run(() -> update.getHost().forceRemoveSubServer(name));
|
||||
subserver = host.constructSubServer(name, server.getBoolean("Enabled"), port, ChatColor.translateAlternateColorCodes('&', server.getString("Motd")), server.getBoolean("Log"),
|
||||
server.getRawString("Directory"), server.getRawString("Executable"), server.getRawString("Stop-Command"), server.getBoolean("Hidden"), server.getBoolean("Restricted"));
|
||||
subserver = host.constructSubServer(name, server.getBoolean("Enabled"), port, ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(server.getString("Motd"))), server.getBoolean("Log"),
|
||||
server.getString("Directory"), server.getString("Executable"), server.getString("Stop-Command"), server.getBoolean("Hidden"), server.getBoolean("Restricted"));
|
||||
|
||||
if (server.getString("Display").length() > 0) subserver.setDisplayName(server.getString("Display"));
|
||||
subserver.setTemplate(server.getRawString("Template"));
|
||||
if (server.getString("Display").length() > 0) subserver.setDisplayName(Util.unescapeJavaString(server.getString("Display")));
|
||||
subserver.setTemplate(server.getString("Template"));
|
||||
for (String group : server.getStringList("Group")) subserver.addGroup(group);
|
||||
SubServer.StopAction action = Try.all.get(() -> SubServer.StopAction.valueOf(server.getRawString("Stop-Action").toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
SubServer.StopAction action = Try.all.get(() -> SubServer.StopAction.valueOf(server.getString("Stop-Action").toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
if (action != null) subserver.setStopAction(action);
|
||||
if (server.contains("Extra")) for (String extra : server.getMap("Extra").getKeys())
|
||||
subserver.addExtra(extra, server.getMap("Extra").getObject(extra));
|
||||
@ -374,9 +374,9 @@ public class InternalSubCreator extends SubCreator {
|
||||
try {
|
||||
if (file.isDirectory() && !file.getName().endsWith(".x")) {
|
||||
ObjectMap<String> config = (new File(file, "template.yml").exists())? new YAMLConfig(new File(file, "template.yml")).get().getMap("Template", new ObjectMap<String>()) : new ObjectMap<String>();
|
||||
ServerTemplate template = loadTemplate(file.getName(), config.getBoolean("Enabled", true), config.getBoolean("Internal", false), config.getRawString("Icon", "::NULL::"), file, config.getMap("Build", new ObjectMap<String>()), config.getMap("Settings", new ObjectMap<String>()));
|
||||
ServerTemplate template = loadTemplate(file.getName(), config.getBoolean("Enabled", true), config.getBoolean("Internal", false), config.getString("Icon", "::NULL::"), file, config.getMap("Build", new ObjectMap<String>()), config.getMap("Settings", new ObjectMap<String>()));
|
||||
templates.put(file.getName().toLowerCase(), template);
|
||||
if (config.getKeys().contains("Display")) template.setDisplayName(config.getString("Display"));
|
||||
if (config.getKeys().contains("Display")) template.setDisplayName(Util.unescapeJavaString(config.getString("Display")));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.get(host.getName()).severe("Couldn't load template: " + file.getName());
|
||||
@ -581,8 +581,8 @@ public class InternalSubCreator extends SubCreator {
|
||||
private Map<String, Object> getSubData() {
|
||||
if (subdata == null || host.plugin.config.get() != subdata.key()) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("Address", host.plugin.config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1").replace("0.0.0.0", "127.0.0.1"));
|
||||
if (host.plugin.config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) map.put("Password", host.plugin.config.get().getMap("Settings").getMap("SubData").getRawString("Password"));
|
||||
map.put("Address", host.plugin.config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1").replace("0.0.0.0", "127.0.0.1"));
|
||||
if (host.plugin.config.get().getMap("Settings").getMap("SubData").getString("Password", "").length() > 0) map.put("Password", host.plugin.config.get().getMap("Settings").getMap("SubData").getString("Password"));
|
||||
subdata = new ContainedPair<>(host.plugin.config.get(), map);
|
||||
}
|
||||
return subdata.value();
|
||||
|
@ -320,7 +320,7 @@ public class InternalSubServer extends SubServerImpl {
|
||||
switch (key.toLowerCase()) {
|
||||
case "name":
|
||||
if (value.isString() && host.removeSubServer(player, getName())) {
|
||||
SubServer server = host.constructSubServer(value.asRawString(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), getPath(), getExecutable(), getStopCommand(), isHidden(), isRestricted());
|
||||
SubServer server = host.constructSubServer(value.asString(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), getPath(), getExecutable(), getStopCommand(), isHidden(), isRestricted());
|
||||
if (server != null) {
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
ObjectMap<String> config = this.host.plugin.servers.get().getMap("Servers").getMap(getName());
|
||||
@ -335,7 +335,7 @@ public class InternalSubServer extends SubServerImpl {
|
||||
break;
|
||||
case "display":
|
||||
if (value.isString()) {
|
||||
setDisplayName(value.asRawString());
|
||||
setDisplayName(value.asString());
|
||||
logger.name = getDisplayName();
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
if (getName().equals(getDisplayName())) {
|
||||
@ -360,9 +360,9 @@ public class InternalSubServer extends SubServerImpl {
|
||||
break;
|
||||
case "group":
|
||||
if (value.isList()) {
|
||||
Util.reflect(ServerImpl.class.getDeclaredField("groups"), this, value.asRawStringList());
|
||||
Util.reflect(ServerImpl.class.getDeclaredField("groups"), this, value.asStringList());
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Group", value.asRawStringList());
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Group", value.asStringList());
|
||||
this.host.plugin.servers.save();
|
||||
}
|
||||
c++;
|
||||
@ -370,7 +370,7 @@ public class InternalSubServer extends SubServerImpl {
|
||||
break;
|
||||
case "host":
|
||||
if (value.isString() && host.removeSubServer(player, getName())) {
|
||||
SubServer server = this.host.plugin.api.getHost(value.asRawString()).constructSubServer(getName(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), getPath(), getExecutable(), getStopCommand(), isHidden(), isRestricted());
|
||||
SubServer server = this.host.plugin.api.getHost(value.asString()).constructSubServer(getName(), isEnabled(), getAddress().getPort(), getMotd(), isLogging(), getPath(), getExecutable(), getStopCommand(), isHidden(), isRestricted());
|
||||
if (server != null) {
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Host", server.getHost().getName());
|
||||
@ -383,9 +383,9 @@ public class InternalSubServer extends SubServerImpl {
|
||||
break;
|
||||
case "template":
|
||||
if (value.isString()) {
|
||||
setTemplate(value.asRawString());
|
||||
setTemplate(value.asString());
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Template", value.asRawString());
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Template", value.asString());
|
||||
this.host.plugin.servers.save();
|
||||
}
|
||||
c++;
|
||||
@ -406,7 +406,7 @@ public class InternalSubServer extends SubServerImpl {
|
||||
break;
|
||||
case "motd":
|
||||
if (value.isString()) {
|
||||
setMotd(ChatColor.translateAlternateColorCodes('&', value.asString()));
|
||||
setMotd(ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(value.asString())));
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Motd", value.asString());
|
||||
this.host.plugin.servers.save();
|
||||
@ -431,8 +431,8 @@ public class InternalSubServer extends SubServerImpl {
|
||||
stop(player);
|
||||
waitFor();
|
||||
}
|
||||
dir = value.asRawString();
|
||||
directory = new File(getHost().getPath(), value.asRawString());
|
||||
dir = value.asString();
|
||||
directory = new File(getHost().getPath(), value.asString());
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Directory", getPath());
|
||||
this.host.plugin.servers.save();
|
||||
@ -447,9 +447,9 @@ public class InternalSubServer extends SubServerImpl {
|
||||
stop(player);
|
||||
waitFor();
|
||||
}
|
||||
executable = value.asRawString();
|
||||
executable = value.asString();
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Executable", value.asRawString());
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Executable", value.asString());
|
||||
this.host.plugin.servers.save();
|
||||
}
|
||||
c++;
|
||||
@ -458,7 +458,7 @@ public class InternalSubServer extends SubServerImpl {
|
||||
case "stop-cmd":
|
||||
case "stop-command":
|
||||
if (value.isString()) {
|
||||
stopcmd = value.asRawString();
|
||||
stopcmd = value.asString();
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
this.host.plugin.servers.get().getMap("Servers").getMap(getName()).set("Stop-Command", getStopCommand());
|
||||
this.host.plugin.servers.save();
|
||||
@ -468,7 +468,7 @@ public class InternalSubServer extends SubServerImpl {
|
||||
break;
|
||||
case "stop-action":
|
||||
if (value.isString()) {
|
||||
StopAction action = Try.all.get(() -> StopAction.valueOf(value.asRawString().toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
StopAction action = Try.all.get(() -> StopAction.valueOf(value.asString().toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
if (action != null) {
|
||||
stopaction = action;
|
||||
if (perma && this.host.plugin.servers.get().getMap("Servers").getKeys().contains(getName())) {
|
||||
|
@ -51,7 +51,7 @@ public abstract class SubCreator {
|
||||
this.internal = internal;
|
||||
this.icon = icon;
|
||||
this.directory = directory;
|
||||
this.type = (build.contains("Server-Type"))?ServerType.valueOf(build.getRawString("Server-Type").toUpperCase()):ServerType.CUSTOM;
|
||||
this.type = (build.contains("Server-Type"))?ServerType.valueOf(build.getString("Server-Type").toUpperCase()):ServerType.CUSTOM;
|
||||
this.build = build;
|
||||
this.options = options;
|
||||
this.dynamic = dynamic;
|
||||
|
@ -113,7 +113,7 @@ public class ConfigUpdater {
|
||||
} if (was.compareTo(new Version("20w08d")) <= 0) {
|
||||
if (existing.contains("Hosts")) {
|
||||
for (String name : existing.getMap("Hosts", new YAMLSection()).getKeys()) {
|
||||
if (existing.getMap("Hosts").getMap(name).getRawString("Driver", "BUILT_IN").replace('-', '_').replace(' ', '_').equalsIgnoreCase("BUILT_IN"))
|
||||
if (existing.getMap("Hosts").getMap(name).getString("Driver", "BUILT_IN").replace('-', '_').replace(' ', '_').equalsIgnoreCase("BUILT_IN"))
|
||||
updated.getMap("Hosts").getMap(name).set("Driver", "VIRTUAL");
|
||||
}
|
||||
}
|
||||
@ -155,9 +155,9 @@ public class ConfigUpdater {
|
||||
if (i > 0) {
|
||||
YAMLSection settings = new YAMLSection();
|
||||
settings.set("Version", ((now.compareTo(was) <= 0)?was:now).toString());
|
||||
if (updated.getMap("Settings", new YAMLSection()).contains("RPEC-Check-Interval")) settings.set("RPEC-Check-Interval", updated.getMap("Settings").getRawString("RPEC-Check-Interval"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).contains("RPEC-Check-Interval")) settings.set("RPEC-Check-Interval", updated.getMap("Settings").getString("RPEC-Check-Interval"));
|
||||
settings.set("Strict-Server-Linking", updated.getMap("Settings", new YAMLSection()).getBoolean("Strict-Server-Linking", true));
|
||||
settings.set("Disabled-Overrides", updated.getMap("Settings", new YAMLSection()).getRawStringList("Disabled-Overrides", Collections.emptyList()));
|
||||
settings.set("Disabled-Overrides", updated.getMap("Settings", new YAMLSection()).getStringList("Disabled-Overrides", Collections.emptyList()));
|
||||
|
||||
YAMLSection smart_fallback = new YAMLSection();
|
||||
smart_fallback.set("Enabled", updated.getMap("Settings", new YAMLSection()).getMap("Smart-Fallback", new YAMLSection()).getBoolean("Enabled", true));
|
||||
@ -173,10 +173,10 @@ public class ConfigUpdater {
|
||||
settings.set("UPnP", upnp);
|
||||
|
||||
YAMLSection subdata = new YAMLSection();
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getRawString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getRawString("Password"));
|
||||
subdata.set("Encryption", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getRawString("Encryption", "RSA/AES"));
|
||||
subdata.set("Whitelist", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getRawStringList("Whitelist", Collections.emptyList()));
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getString("Password"));
|
||||
subdata.set("Encryption", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getString("Encryption", "RSA/AES"));
|
||||
subdata.set("Whitelist", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getStringList("Whitelist", Collections.emptyList()));
|
||||
settings.set("SubData", subdata);
|
||||
|
||||
rewritten.set("Settings", settings);
|
||||
@ -186,12 +186,12 @@ public class ConfigUpdater {
|
||||
for (String name : updated.getMap("Hosts", new YAMLSection()).getKeys()) {
|
||||
YAMLSection host = new YAMLSection();
|
||||
host.set("Enabled", updated.getMap("Hosts").getMap(name).getBoolean("Enabled", false));
|
||||
host.set("Display", updated.getMap("Hosts").getMap(name).getRawString("Display", ""));
|
||||
host.set("Driver", updated.getMap("Hosts").getMap(name).getRawString("Driver", "VIRTUAL"));
|
||||
host.set("Address", updated.getMap("Hosts").getMap(name).getRawString("Address", "127.0.0.1"));
|
||||
host.set("Port-Range", updated.getMap("Hosts").getMap(name).getRawString("Port-Range", "25500-25559"));
|
||||
host.set("Directory", updated.getMap("Hosts").getMap(name).getRawString("Directory", (host.getRawString("Driver").equalsIgnoreCase("VIRTUAL"))?"./SubServers/Servers":"./Servers"));
|
||||
host.set("Git-Bash", updated.getMap("Hosts").getMap(name).getRawString("Git-Bash", "%ProgramFiles%\\Git"));
|
||||
host.set("Display", updated.getMap("Hosts").getMap(name).getString("Display", ""));
|
||||
host.set("Driver", updated.getMap("Hosts").getMap(name).getString("Driver", "VIRTUAL"));
|
||||
host.set("Address", updated.getMap("Hosts").getMap(name).getString("Address", "127.0.0.1"));
|
||||
host.set("Port-Range", updated.getMap("Hosts").getMap(name).getString("Port-Range", "25500-25559"));
|
||||
host.set("Directory", updated.getMap("Hosts").getMap(name).getString("Directory", (host.getString("Driver").equalsIgnoreCase("VIRTUAL"))?"./SubServers/Servers":"./Servers"));
|
||||
host.set("Git-Bash", updated.getMap("Hosts").getMap(name).getString("Git-Bash", "%ProgramFiles%\\Git"));
|
||||
host.set("Log-Creator", updated.getMap("Hosts").getMap(name).getBoolean("Log-Creator", true));
|
||||
if (updated.getMap("Hosts").getMap(name).contains("Extra")) host.set("Extra", updated.getMap("Hosts").getMap(name).getMap("Extra"));
|
||||
hosts.set(name, host);
|
||||
@ -233,7 +233,7 @@ public class ConfigUpdater {
|
||||
if (existing.getMap("Servers").getMap(name).getBoolean("Auto-Restart", true))
|
||||
updated.getMap("Servers").getMap(name).safeSet("Stop-Action", "RESTART");
|
||||
|
||||
if (existing.getMap("Servers").getMap(name).getRawString("Stop-Action", "NONE").equalsIgnoreCase("DELETE_SERVER"))
|
||||
if (existing.getMap("Servers").getMap(name).getString("Stop-Action", "NONE").equalsIgnoreCase("DELETE_SERVER"))
|
||||
updated.getMap("Servers").getMap(name).set("Stop-Action", "RECYCLE_SERVER");
|
||||
}
|
||||
}
|
||||
@ -260,20 +260,20 @@ public class ConfigUpdater {
|
||||
for (String name : updated.getMap("Servers", new YAMLSection()).getKeys()) {
|
||||
YAMLSection server = new YAMLSection();
|
||||
server.set("Enabled", updated.getMap("Servers").getMap(name).getBoolean("Enabled", false));
|
||||
server.set("Display", updated.getMap("Servers").getMap(name).getRawString("Display", ""));
|
||||
server.set("Host", updated.getMap("Servers").getMap(name).getRawString("Host", "~"));
|
||||
if (updated.getMap("Servers").getMap(name).contains("Template")) server.set("Template", updated.getMap("Servers").getMap(name).getRawString("Template"));
|
||||
server.set("Group", updated.getMap("Servers").getMap(name).getRawStringList("Groups", Collections.emptyList()));
|
||||
server.set("Display", updated.getMap("Servers").getMap(name).getString("Display", ""));
|
||||
server.set("Host", updated.getMap("Servers").getMap(name).getString("Host", "~"));
|
||||
if (updated.getMap("Servers").getMap(name).contains("Template")) server.set("Template", updated.getMap("Servers").getMap(name).getString("Template"));
|
||||
server.set("Group", updated.getMap("Servers").getMap(name).getStringList("Groups", Collections.emptyList()));
|
||||
server.set("Port", updated.getMap("Servers").getMap(name).getInt("Port", 25567));
|
||||
server.set("Motd", updated.getMap("Servers").getMap(name).getRawString("Motd", "Some SubServer"));
|
||||
server.set("Motd", updated.getMap("Servers").getMap(name).getString("Motd", "Some SubServer"));
|
||||
server.set("Log", updated.getMap("Servers").getMap(name).getBoolean("Log", true));
|
||||
server.set("Directory", updated.getMap("Servers").getMap(name).getRawString("Directory", "." + File.separatorChar));
|
||||
server.set("Executable", updated.getMap("Servers").getMap(name).getRawString("Executable", "java -Xmx1024M -Djline.terminal=jline.UnsupportedTerminal -jar Spigot.jar"));
|
||||
server.set("Stop-Command", updated.getMap("Servers").getMap(name).getRawString("Stop-Command", "stop"));
|
||||
server.set("Stop-Action", updated.getMap("Servers").getMap(name).getRawString("Stop-Action", "NONE"));
|
||||
server.set("Directory", updated.getMap("Servers").getMap(name).getString("Directory", "." + File.separatorChar));
|
||||
server.set("Executable", updated.getMap("Servers").getMap(name).getString("Executable", "java -Xmx1024M -Djline.terminal=jline.UnsupportedTerminal -jar Spigot.jar"));
|
||||
server.set("Stop-Command", updated.getMap("Servers").getMap(name).getString("Stop-Command", "stop"));
|
||||
server.set("Stop-Action", updated.getMap("Servers").getMap(name).getString("Stop-Action", "NONE"));
|
||||
server.set("Run-On-Launch", updated.getMap("Servers").getMap(name).getBoolean("Run-On-Launch", false));
|
||||
server.set("Restricted", updated.getMap("Servers").getMap(name).getBoolean("Restricted", false));
|
||||
server.set("Incompatible", updated.getMap("Servers").getMap(name).getRawStringList("Incompatible", Collections.emptyList()));
|
||||
server.set("Incompatible", updated.getMap("Servers").getMap(name).getStringList("Incompatible", Collections.emptyList()));
|
||||
server.set("Hidden", updated.getMap("Servers").getMap(name).getBoolean("Hidden", false));
|
||||
if (updated.getMap("Servers").getMap(name).contains("Extra")) server.set("Extra", updated.getMap("Servers").getMap(name).getMap("Extra"));
|
||||
servers.set(name, server);
|
||||
@ -541,7 +541,7 @@ public class ConfigUpdater {
|
||||
def.put("Interface.SubServer-Plugin.No-Plugins", "&c&oThere are No Plugins Available");
|
||||
|
||||
YAMLSection lang = new YAMLSection();
|
||||
for (String key : def.keySet()) lang.set(key, updated.getMap("Lang", new YAMLSection()).getRawString(key, def.get(key)));
|
||||
for (String key : def.keySet()) lang.set(key, updated.getMap("Lang", new YAMLSection()).getString(key, def.get(key)));
|
||||
rewritten.set("Lang", lang);
|
||||
|
||||
config.set(rewritten);
|
||||
|
@ -57,7 +57,7 @@ public class PacketAddServer implements PacketObjectIn<Integer>, PacketObjectOut
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String name = data.getString(0x0001);
|
||||
boolean subserver = data.getBoolean(0x0002);
|
||||
ObjectMap<String> opt = new ObjectMap<>((Map<String, ?>)data.getObject(0x0003));
|
||||
UUID player = (data.contains(0x0004)?data.getUUID(0x0004):null);
|
||||
@ -66,17 +66,17 @@ public class PacketAddServer implements PacketObjectIn<Integer>, PacketObjectOut
|
||||
client.sendPacket(new PacketAddServer(3, tracker));
|
||||
} else {
|
||||
if (!subserver) {
|
||||
if (plugin.api.addServer(player, name, InetAddress.getByName(opt.getRawString("address").split(":")[0]), Integer.parseInt(opt.getRawString("address").split(":")[1]),
|
||||
ChatColor.translateAlternateColorCodes('&', opt.getString("motd")), opt.getBoolean("hidden"), opt.getBoolean("restricted")) != null) {
|
||||
if (plugin.api.addServer(player, name, InetAddress.getByName(opt.getString("address").split(":")[0]), Integer.parseInt(opt.getString("address").split(":")[1]),
|
||||
ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(opt.getString("motd"))), opt.getBoolean("hidden"), opt.getBoolean("restricted")) != null) {
|
||||
client.sendPacket(new PacketAddServer(0, tracker));
|
||||
} else {
|
||||
client.sendPacket(new PacketAddServer(1, tracker));
|
||||
}
|
||||
} else if (!plugin.api.getHosts().keySet().contains(opt.getRawString("host").toLowerCase())) {
|
||||
} else if (!plugin.api.getHosts().keySet().contains(opt.getString("host").toLowerCase())) {
|
||||
client.sendPacket(new PacketAddServer(4, tracker));
|
||||
} else {
|
||||
if (plugin.api.getHost(opt.getRawString("host")).addSubServer(player, name, opt.getBoolean("enabled"), opt.getInt("port"), ChatColor.translateAlternateColorCodes('&', opt.getString("motd")),
|
||||
opt.getBoolean("log"), opt.getRawString("dir"), opt.getRawString("exec"), opt.getRawString("stop-cmd"), opt.getBoolean("hidden"), opt.getBoolean("restricted")) != null) {
|
||||
if (plugin.api.getHost(opt.getString("host")).addSubServer(player, name, opt.getBoolean("enabled"), opt.getInt("port"), ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(opt.getString("motd"))),
|
||||
opt.getBoolean("log"), opt.getString("dir"), opt.getString("exec"), opt.getString("stop-cmd"), opt.getBoolean("hidden"), opt.getBoolean("restricted")) != null) {
|
||||
client.sendPacket(new PacketAddServer(0, tracker));
|
||||
} else {
|
||||
client.sendPacket(new PacketAddServer(1, tracker));
|
||||
|
@ -50,7 +50,7 @@ public class PacketCheckPermission implements PacketObjectIn<Integer>, PacketObj
|
||||
|
||||
@Override
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) throws Throwable {
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,8 +53,8 @@ public class PacketCommandServer implements PacketObjectIn<Integer>, PacketObjec
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String server = data.getRawString(0x0001);
|
||||
String command = data.getRawString(0x0002);
|
||||
String server = data.getString(0x0001);
|
||||
String command = data.getString(0x0002);
|
||||
UUID player = (data.contains(0x0003)?data.getUUID(0x0003):null);
|
||||
|
||||
Map<String, Server> servers = plugin.api.getServers();
|
||||
|
@ -50,9 +50,9 @@ public class PacketCreateServer implements PacketObjectIn<Integer>, PacketObject
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String host = data.getRawString(0x0002);
|
||||
String template = data.getRawString(0x0003);
|
||||
String name = data.getString(0x0001);
|
||||
String host = data.getString(0x0002);
|
||||
String template = data.getString(0x0003);
|
||||
Version version = (data.contains(0x0004)?data.getVersion(0x0004):null);
|
||||
Integer port = (data.contains(0x0005)?data.getInt(0x0005):null);
|
||||
UUID player = (data.contains(0x0006)?data.getUUID(0x0006):null);
|
||||
|
@ -53,7 +53,7 @@ public class PacketDeleteServer implements PacketObjectIn<Integer>, PacketObject
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String name = data.getString(0x0001);
|
||||
boolean recycle = data.getBoolean(0x0002);
|
||||
boolean force = data.getBoolean(0x0003);
|
||||
UUID player = (data.contains(0x0004)?data.getUUID(0x0004):null);
|
||||
|
@ -52,7 +52,7 @@ public class PacketDisconnectPlayer implements PacketObjectIn<Integer>, PacketOb
|
||||
@Override
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
run(data.getUUIDList(0x0001), data.contains(0x0002)?data.getRawString(0x0002):null, i -> {
|
||||
run(data.getUUIDList(0x0001), data.contains(0x0002)?data.getString(0x0002):null, i -> {
|
||||
client.sendPacket(new PacketDisconnectPlayer(i, tracker));
|
||||
});
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class PacketDownloadGroupInfo implements PacketObjectIn<Integer>, PacketO
|
||||
|
||||
@Override
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
client.sendPacket(new PacketDownloadGroupInfo(plugin, (data.contains(0x0001))?data.getRawStringList(0x0001):null, (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
client.sendPacket(new PacketDownloadGroupInfo(plugin, (data.contains(0x0001))?data.getStringList(0x0001):null, (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,7 +66,7 @@ public class PacketDownloadHostInfo implements PacketObjectIn<Integer>, PacketOb
|
||||
|
||||
@Override
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
client.sendPacket(new PacketDownloadHostInfo(plugin, (data.contains(0x0001))?data.getRawStringList(0x0001):null, (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
client.sendPacket(new PacketDownloadHostInfo(plugin, (data.contains(0x0001))?data.getStringList(0x0001):null, (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +79,7 @@ public class PacketDownloadPlayerInfo implements PacketObjectIn<Integer>, Packet
|
||||
|
||||
@Override
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
client.sendPacket(new PacketDownloadPlayerInfo(plugin, (data.contains(0x0001))?data.getRawStringList(0x0001):null, (data.contains(0x0002))?data.getUUIDList(0x0002):null, (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
client.sendPacket(new PacketDownloadPlayerInfo(plugin, (data.contains(0x0001))?data.getStringList(0x0001):null, (data.contains(0x0002))?data.getUUIDList(0x0002):null, (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,7 +69,7 @@ public class PacketDownloadProxyInfo implements PacketObjectIn<Integer>, PacketO
|
||||
|
||||
@Override
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
client.sendPacket(new PacketDownloadProxyInfo(plugin, (data.contains(0x0001))?data.getRawStringList(0x0001):null, (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
client.sendPacket(new PacketDownloadProxyInfo(plugin, (data.contains(0x0001))?data.getStringList(0x0001):null, (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,7 +66,7 @@ public class PacketDownloadServerInfo implements PacketObjectIn<Integer>, Packet
|
||||
|
||||
@Override
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
client.sendPacket(new PacketDownloadServerInfo(plugin, (data.contains(0x0001))?data.getRawStringList(0x0001):null, (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
client.sendPacket(new PacketDownloadServerInfo(plugin, (data.contains(0x0001))?data.getStringList(0x0001):null, (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,7 +68,7 @@ public class PacketEditServer implements PacketObjectIn<Integer>, PacketObjectOu
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String name = data.getString(0x0001);
|
||||
ObjectMap<String> edit = new ObjectMap<>((Map<String, ?>)data.getObject(0x0002));
|
||||
boolean perma = data.getBoolean(0x0003);
|
||||
UUID player = (data.contains(0x0004)?data.getUUID(0x0004):null);
|
||||
|
@ -89,7 +89,7 @@ public class PacketExControlServer implements PacketObjectIn<Integer>, PacketObj
|
||||
@Override
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
try {
|
||||
ExternalSubServer server = (ExternalSubServer) plugin.api.getSubServer(data.getRawString(0x0000));
|
||||
ExternalSubServer server = (ExternalSubServer) plugin.api.getSubServer(data.getString(0x0000));
|
||||
switch (data.getInt(0x0001)) {
|
||||
case 1:
|
||||
Util.reflect(ExternalSubServer.class.getDeclaredMethod("falsestart"), server);
|
||||
|
@ -45,10 +45,10 @@ public class PacketExUploadTemplates implements PacketObjectIn<Integer>, PacketO
|
||||
try {
|
||||
File dir = new File(templatedir, name);
|
||||
SubCreator.ServerTemplate template = Util.reflect(SubCreator.class.getDeclaredMethod("loadTemplate", String.class, boolean.class, boolean.class, String.class, File.class, ObjectMap.class, ObjectMap.class),
|
||||
((ExternalHost) client.getHandler()).getCreator(), name, templates.getMap(name).getBoolean("enabled"), templates.getMap(name).getBoolean("internal"), templates.getMap(name).getRawString("icon"), dir,
|
||||
((ExternalHost) client.getHandler()).getCreator(), name, templates.getMap(name).getBoolean("enabled"), templates.getMap(name).getBoolean("internal"), templates.getMap(name).getString("icon"), dir,
|
||||
templates.getMap(name).getMap("build").clone(), templates.getMap(name).getMap("settings").clone());
|
||||
map.put(name.toLowerCase(), template);
|
||||
if (!templates.getMap(name).getRawString("display").equals(name)) template.setDisplayName(templates.getMap(name).getRawString("display"));
|
||||
if (!templates.getMap(name).getString("display").equals(name)) template.setDisplayName(templates.getMap(name).getString("display"));
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger("SubServers").severe("Couldn't load template: " + name);
|
||||
e.printStackTrace();
|
||||
|
@ -26,7 +26,7 @@ public class PacketInExLogMessage implements PacketObjectIn<Integer> {
|
||||
if (data.contains(0x0000)) {
|
||||
if (data.contains(0x0002) && data.contains(0x0001)) {
|
||||
if (loggers.containsKey(data.getUUID(0x0000))) {
|
||||
Util.reflect(ExternalSubLogger.class.getDeclaredMethod("log", int.class, String.class), loggers.get(data.getUUID(0x0000)), data.getInt(0x0001), data.getRawString(0x0002));
|
||||
Util.reflect(ExternalSubLogger.class.getDeclaredMethod("log", int.class, String.class), loggers.get(data.getUUID(0x0000)), data.getInt(0x0001), data.getString(0x0002));
|
||||
}
|
||||
} else {
|
||||
unregister(data.getUUID(0x0000));
|
||||
|
@ -59,8 +59,8 @@ public class PacketLinkExHost implements InitialPacket, PacketObjectIn<Integer>,
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
try {
|
||||
Map<String, Host> hosts = plugin.api.getHosts();
|
||||
if (hosts.keySet().contains(data.getRawString(0x0000).toLowerCase())) {
|
||||
Host host = hosts.get(data.getRawString(0x0000).toLowerCase());
|
||||
if (hosts.keySet().contains(data.getString(0x0000).toLowerCase())) {
|
||||
Host host = hosts.get(data.getString(0x0000).toLowerCase());
|
||||
if (host instanceof ExternalHost) {
|
||||
Integer channel = data.getInt(0x0001);
|
||||
HashMap<Integer, SubDataClient> subdata = Try.all.get(() -> Util.reflect(ExternalHost.class.getDeclaredField("subdata"), host));
|
||||
@ -76,7 +76,7 @@ public class PacketLinkExHost implements InitialPacket, PacketObjectIn<Integer>,
|
||||
client.sendPacket(new PacketLinkExHost(4, "That host does not support a network interface"));
|
||||
}
|
||||
} else {
|
||||
client.sendPacket(new PacketLinkExHost(2, "There is no host with name: " + data.getRawString(0x0000)));
|
||||
client.sendPacket(new PacketLinkExHost(2, "There is no host with name: " + data.getString(0x0000)));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
client.sendPacket(new PacketLinkExHost(1, null));
|
||||
|
@ -61,7 +61,7 @@ public class PacketLinkProxy implements InitialPacket, PacketObjectIn<Integer>,
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
try {
|
||||
Map<String, Proxy> proxies = plugin.api.getProxies();
|
||||
String name = ((data.contains(0x0000))?data.getRawString(0x0000):null);
|
||||
String name = ((data.contains(0x0000))?data.getString(0x0000):null);
|
||||
Integer channel = data.getInt(0x0001);
|
||||
|
||||
boolean isnew = false;
|
||||
|
@ -74,7 +74,7 @@ public class PacketLinkServer implements InitialPacket, PacketObjectIn<Integer>,
|
||||
|
||||
@Override
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
String name = (data.contains(0x0000))?data.getRawString(0x0000):null;
|
||||
String name = (data.contains(0x0000))?data.getString(0x0000):null;
|
||||
Integer channel = data.getInt(0x0002);
|
||||
InetSocketAddress address;
|
||||
|
||||
@ -84,7 +84,7 @@ public class PacketLinkServer implements InitialPacket, PacketObjectIn<Integer>,
|
||||
} else if (data.isNumber(0x0001)) {
|
||||
address = new InetSocketAddress(client.getAddress().getAddress(), data.getInt(0x0001));
|
||||
} else {
|
||||
String[] sa = data.getRawString(0x0001).split(":");
|
||||
String[] sa = data.getString(0x0001).split(":");
|
||||
address = new InetSocketAddress(sa[0], Integer.parseInt(sa[1]));
|
||||
}
|
||||
|
||||
|
@ -114,8 +114,8 @@ public class PacketMessagePlayer implements PacketObjectIn<Integer>, PacketObjec
|
||||
raw = null;
|
||||
}
|
||||
} else {
|
||||
legacy = (data.contains(0x0002)?data.getRawStringList(0x0002):null);
|
||||
raw = (data.contains(0x0003)?data.getRawStringList(0x0003):null);
|
||||
legacy = (data.contains(0x0002)?data.getStringList(0x0002):null);
|
||||
raw = (data.contains(0x0003)?data.getStringList(0x0003):null);
|
||||
}
|
||||
for (Map.Entry<Proxy, List<UUID>> entry : requests.entrySet()) {
|
||||
merge.reserve();
|
||||
@ -134,9 +134,9 @@ public class PacketMessagePlayer implements PacketObjectIn<Integer>, PacketObjec
|
||||
private static ContainedPair<String[], BaseComponent[][]> parseMessage(ObjectMap<Integer> data) {
|
||||
ContainedPair<String[], BaseComponent[][]> value = new ContainedPair<>();
|
||||
if (data.contains(0x0002))
|
||||
value.key = data.getRawStringList(0x0002).toArray(new String[0]);
|
||||
value.key = data.getStringList(0x0002).toArray(new String[0]);
|
||||
if (data.contains(0x0003)) {
|
||||
List<String> messages = data.getRawStringList(0x0003);
|
||||
List<String> messages = data.getStringList(0x0003);
|
||||
BaseComponent[][] components = new BaseComponent[messages.size()][];
|
||||
for (int i = 0; i < components.length; ++i) components[i] = ComponentSerializer.parse(messages.get(i));
|
||||
value.value = components;
|
||||
|
@ -54,7 +54,7 @@ public class PacketRemoveServer implements PacketObjectIn<Integer>, PacketObject
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String name = data.getString(0x0001);
|
||||
boolean force = data.getBoolean(0x0002);
|
||||
UUID player = (data.contains(0x0003)?data.getUUID(0x0003):null);
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class PacketRestartServer implements PacketObjectIn<Integer>, PacketObjec
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String name = data.getString(0x0001);
|
||||
UUID player = (data.contains(0x0002)?data.getUUID(0x0002):null);
|
||||
|
||||
Runnable starter = () -> {
|
||||
|
@ -66,7 +66,7 @@ public class PacketStartServer implements PacketObjectIn<Integer>, PacketObjectO
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String name = data.getString(0x0001);
|
||||
UUID player = (data.contains(0x0002)?data.getUUID(0x0002):null);
|
||||
|
||||
Map<String, Server> servers = plugin.api.getServers();
|
||||
|
@ -53,7 +53,7 @@ public class PacketStopServer implements PacketObjectIn<Integer>, PacketObjectOu
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String name = data.getString(0x0001);
|
||||
boolean force = (data.contains(0x0002)?data.getBoolean(0x0002):false);
|
||||
UUID player = (data.contains(0x0003)?data.getUUID(0x0003):null);
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class PacketTransferPlayer implements PacketObjectIn<Integer>, PacketObje
|
||||
@Override
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
run(data.getUUIDList(0x0001), data.getRawString(0x0002), i -> {
|
||||
run(data.getUUIDList(0x0001), data.getString(0x0002), i -> {
|
||||
client.sendPacket(new PacketTransferPlayer(i, tracker));
|
||||
});
|
||||
}
|
||||
|
@ -53,8 +53,8 @@ public class PacketUpdateServer implements PacketObjectIn<Integer>, PacketObject
|
||||
public void receive(SubDataClient client, ObjectMap<Integer> data) {
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String template = (data.contains(0x0002)?data.getRawString(0x0002):null);
|
||||
String name = data.getString(0x0001);
|
||||
String template = (data.contains(0x0002)?data.getString(0x0002):null);
|
||||
Version version = (data.contains(0x0003)?data.getVersion(0x0003):null);
|
||||
UUID player = (data.contains(0x0004)?data.getUUID(0x0004):null);
|
||||
boolean waitfor = (data.contains(0x0005)?data.getBoolean(0x0005):false);
|
||||
|
@ -302,7 +302,7 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
try {
|
||||
if (Util.getCaseInsensitively(config.get().getMap("Hosts").get(), servers.get().getMap("Servers").getMap(name).getString("Host")) == null) throw new InvalidServerException("There is no host with this name: " + servers.get().getMap("Servers").getMap(name).getString("Host"));
|
||||
legServers.put(name, constructServerInfo(name, new InetSocketAddress(InetAddress.getByName((String) ((Map<String, ?>) Util.getCaseInsensitively(config.get().getMap("Hosts").get(), servers.get().getMap("Servers").getMap(name).getString("Host"))).get("Address")), servers.get().getMap("Servers").getMap(name).getInt("Port")),
|
||||
ChatColor.translateAlternateColorCodes('&', servers.get().getMap("Servers").getMap(name).getString("Motd")), servers.get().getMap("Servers").getMap(name).getBoolean("Restricted")));
|
||||
ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(servers.get().getMap("Servers").getMap(name).getString("Motd"))), servers.get().getMap("Servers").getMap(name).getBoolean("Restricted")));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -356,11 +356,11 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
servers.reload();
|
||||
lang.reload();
|
||||
for (String key : lang.get().getMap("Lang").getKeys())
|
||||
api.setLang("SubServers", key, ChatColor.translateAlternateColorCodes('&', lang.get().getMap("Lang").getString(key)));
|
||||
api.setLang("SubServers", key, ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(lang.get().getMap("Lang").getString(key))));
|
||||
|
||||
if (subdata != null && ( // SubData Server must be reset
|
||||
!config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").equals(prevconfig.getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391")) ||
|
||||
!config.get().getMap("Settings").getMap("SubData").getRawString("Encryption", "NONE").equals(prevconfig.getMap("Settings").getMap("SubData").getRawString("Encryption", "NONE"))
|
||||
!config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").equals(prevconfig.getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391")) ||
|
||||
!config.get().getMap("Settings").getMap("SubData").getString("Encryption", "NONE").equals(prevconfig.getMap("Settings").getMap("SubData").getString("Encryption", "NONE"))
|
||||
)) {
|
||||
SubDataServer subdata = this.subdata;
|
||||
subdata.close();
|
||||
@ -376,31 +376,31 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
if (!ukeys.contains(name.toLowerCase())) try {
|
||||
boolean add = false;
|
||||
Host host = this.hosts.get(name.toLowerCase());
|
||||
Class<? extends Host> driver = hostDrivers.get(config.get().getMap("Hosts").getMap(name).getRawString("Driver").toUpperCase().replace('-', '_').replace(' ', '_'));
|
||||
Class<? extends Host> driver = hostDrivers.get(config.get().getMap("Hosts").getMap(name).getString("Driver").toUpperCase().replace('-', '_').replace(' ', '_'));
|
||||
if (driver == null) throw new InvalidHostException("Invalid Driver for host: " + name);
|
||||
if (host == null || // Host must be reset
|
||||
!hostDrivers.get(config.get().getMap("Hosts").getMap(name).getRawString("Driver").toUpperCase().replace('-', '_').replace(' ', '_')).equals(host.getClass()) ||
|
||||
!config.get().getMap("Hosts").getMap(name).getRawString("Address").equals(host.getAddress().getHostAddress()) ||
|
||||
!config.get().getMap("Hosts").getMap(name).getRawString("Directory").equals(host.getPath()) ||
|
||||
!config.get().getMap("Hosts").getMap(name).getRawString("Git-Bash").equals(host.getCreator().getBashDirectory())
|
||||
!hostDrivers.get(config.get().getMap("Hosts").getMap(name).getString("Driver").toUpperCase().replace('-', '_').replace(' ', '_')).equals(host.getClass()) ||
|
||||
!config.get().getMap("Hosts").getMap(name).getString("Address").equals(host.getAddress().getHostAddress()) ||
|
||||
!config.get().getMap("Hosts").getMap(name).getString("Directory").equals(host.getPath()) ||
|
||||
!config.get().getMap("Hosts").getMap(name).getString("Git-Bash").equals(host.getCreator().getBashDirectory())
|
||||
) {
|
||||
if (host != null) api.forceRemoveHost(name);
|
||||
add = true;
|
||||
host = constructHost(driver, name, config.get().getMap("Hosts").getMap(name).getBoolean("Enabled"),
|
||||
Range.closed(Integer.parseInt(config.get().getMap("Hosts").getMap(name).getRawString("Port-Range", "25500-25559").split("-")[0]), Integer.parseInt(config.get().getMap("Hosts").getMap(name).getRawString("Port-Range", "25500-25559").split("-")[1])),
|
||||
config.get().getMap("Hosts").getMap(name).getBoolean("Log-Creator", true), InetAddress.getByName(config.get().getMap("Hosts").getMap(name).getRawString("Address")),
|
||||
config.get().getMap("Hosts").getMap(name).getRawString("Directory"), config.get().getMap("Hosts").getMap(name).getRawString("Git-Bash"));
|
||||
Range.closed(Integer.parseInt(config.get().getMap("Hosts").getMap(name).getString("Port-Range", "25500-25559").split("-")[0]), Integer.parseInt(config.get().getMap("Hosts").getMap(name).getString("Port-Range", "25500-25559").split("-")[1])),
|
||||
config.get().getMap("Hosts").getMap(name).getBoolean("Log-Creator", true), InetAddress.getByName(config.get().getMap("Hosts").getMap(name).getString("Address")),
|
||||
config.get().getMap("Hosts").getMap(name).getString("Directory"), config.get().getMap("Hosts").getMap(name).getString("Git-Bash"));
|
||||
} else { // Host wasn't reset, so check for these changes
|
||||
if (config.get().getMap("Hosts").getMap(name).getBoolean("Enabled") != host.isEnabled())
|
||||
host.setEnabled(config.get().getMap("Hosts").getMap(name).getBoolean("Enabled"));
|
||||
if (!config.get().getMap("Hosts").getMap(name).getRawString("Port-Range", "25500-25559").equals(prevconfig.getMap("Hosts", new ObjectMap<String>()).getMap(name, new ObjectMap<String>()).getRawString("Port-Range", "25500-25559")))
|
||||
host.getCreator().setPortRange(Range.closed(Integer.parseInt(config.get().getMap("Hosts").getMap(name).getRawString("Port-Range", "25500-25559").split("-")[0]), Integer.parseInt(config.get().getMap("Hosts").getMap(name).getRawString("Port-Range", "25500-25559").split("-")[1])));
|
||||
if (!config.get().getMap("Hosts").getMap(name).getString("Port-Range", "25500-25559").equals(prevconfig.getMap("Hosts", new ObjectMap<String>()).getMap(name, new ObjectMap<String>()).getString("Port-Range", "25500-25559")))
|
||||
host.getCreator().setPortRange(Range.closed(Integer.parseInt(config.get().getMap("Hosts").getMap(name).getString("Port-Range", "25500-25559").split("-")[0]), Integer.parseInt(config.get().getMap("Hosts").getMap(name).getString("Port-Range", "25500-25559").split("-")[1])));
|
||||
if (config.get().getMap("Hosts").getMap(name).getBoolean("Log-Creator", true) != host.getCreator().isLogging())
|
||||
host.getCreator().setLogging(config.get().getMap("Hosts").getMap(name).getBoolean("Log-Creator", true));
|
||||
host.getCreator().reload();
|
||||
} // Check for other changes
|
||||
if (config.get().getMap("Hosts").getMap(name).getKeys().contains("Display") && ((config.get().getMap("Hosts").getMap(name).getString("Display").length() == 0 && !host.getName().equals(host.getDisplayName())) || (config.get().getMap("Hosts").getMap(name).getString("Display").length() > 0 && !config.get().getMap("Hosts").getMap(name).getString("Display").equals(host.getDisplayName()))))
|
||||
host.setDisplayName(config.get().getMap("Hosts").getMap(name).getString("Display"));
|
||||
if (config.get().getMap("Hosts").getMap(name).getKeys().contains("Display") && ((config.get().getMap("Hosts").getMap(name).getString("Display").length() == 0 && !host.getName().equals(host.getDisplayName())) || (config.get().getMap("Hosts").getMap(name).getString("Display").length() > 0 && !Util.unescapeJavaString(config.get().getMap("Hosts").getMap(name).getString("Display")).equals(host.getDisplayName()))))
|
||||
host.setDisplayName(Util.unescapeJavaString(config.get().getMap("Hosts").getMap(name).getString("Display")));
|
||||
if (config.get().getMap("Hosts").getMap(name).getKeys().contains("Extra"))
|
||||
for (String extra : config.get().getMap("Hosts").getMap(name).getMap("Extra").getKeys()) host.addExtra(extra, config.get().getMap("Hosts").getMap(name).getMap("Extra").getObject(extra));
|
||||
if (add)
|
||||
@ -422,23 +422,23 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
Server server = api.getServer(name);
|
||||
if (server == null || !(server instanceof SubServer)) {
|
||||
if (server == null || // Server must be reset
|
||||
bungee.get().getMap("servers").getMap(name).getRawString("address").equals(server.getAddress().getAddress().getHostAddress() + ':' + server.getAddress().getPort())
|
||||
bungee.get().getMap("servers").getMap(name).getString("address").equals(server.getAddress().getAddress().getHostAddress() + ':' + server.getAddress().getPort())
|
||||
) {
|
||||
if (server != null) api.forceRemoveServer(name);
|
||||
add = true;
|
||||
server = ServerImpl.construct(name, new InetSocketAddress(InetAddress.getByName(bungee.get().getMap("servers").getMap(name).getRawString("address").split(":")[0]),
|
||||
Integer.parseInt(bungee.get().getMap("servers").getMap(name).getRawString("address").split(":")[1])), ChatColor.translateAlternateColorCodes('&', bungee.get().getMap("servers").getMap(name).getString("motd")),
|
||||
server = ServerImpl.construct(name, new InetSocketAddress(InetAddress.getByName(bungee.get().getMap("servers").getMap(name).getString("address").split(":")[0]),
|
||||
Integer.parseInt(bungee.get().getMap("servers").getMap(name).getString("address").split(":")[1])), ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(bungee.get().getMap("servers").getMap(name).getString("motd"))),
|
||||
bungee.get().getMap("servers").getMap(name).getBoolean("hidden", false), bungee.get().getMap("servers").getMap(name).getBoolean("restricted"));
|
||||
} else { // Server wasn't reset, so check for these changes
|
||||
if (!ChatColor.translateAlternateColorCodes('&', bungee.get().getMap("servers").getMap(name).getString("motd")).equals(server.getMotd()))
|
||||
server.setMotd(ChatColor.translateAlternateColorCodes('&', bungee.get().getMap("servers").getMap(name).getString("motd")));
|
||||
if (!ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(bungee.get().getMap("servers").getMap(name).getString("motd"))).equals(server.getMotd()))
|
||||
server.setMotd(ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(bungee.get().getMap("servers").getMap(name).getString("motd"))));
|
||||
if (bungee.get().getMap("servers").getMap(name).getBoolean("hidden", false) != server.isHidden())
|
||||
server.setHidden(bungee.get().getMap("servers").getMap(name).getBoolean("hidden", false));
|
||||
if (bungee.get().getMap("servers").getMap(name).getBoolean("restricted") != server.isRestricted())
|
||||
server.setRestricted(bungee.get().getMap("servers").getMap(name).getBoolean("restricted"));
|
||||
} // Check for other changes
|
||||
if (bungee.get().getMap("servers").getMap(name).getKeys().contains("display") && ((bungee.get().getMap("servers").getMap(name).getRawString("display").length() == 0 && !server.getName().equals(server.getDisplayName())) || (bungee.get().getMap("servers").getMap(name).getRawString("display").length() > 0 && !bungee.get().getMap("servers").getMap(name).getRawString("display").equals(server.getDisplayName()))))
|
||||
server.setDisplayName(bungee.get().getMap("servers").getMap(name).getString("display"));
|
||||
if (bungee.get().getMap("servers").getMap(name).getKeys().contains("display") && ((bungee.get().getMap("servers").getMap(name).getString("display").length() == 0 && !server.getName().equals(server.getDisplayName())) || (bungee.get().getMap("servers").getMap(name).getString("display").length() > 0 && !bungee.get().getMap("servers").getMap(name).getString("display").equals(server.getDisplayName()))))
|
||||
server.setDisplayName(Util.unescapeJavaString(bungee.get().getMap("servers").getMap(name).getString("display")));
|
||||
if (bungee.get().getMap("servers").getMap(name).getKeys().contains("group")) {
|
||||
for (String group : server.getGroups()) server.removeGroup(group);
|
||||
for (String group : bungee.get().getMap("servers").getMap(name).getStringList("group")) server.addGroup(group);
|
||||
@ -474,27 +474,27 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
ObjectMap<String> edits = new ObjectMap<String>();
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getBoolean("Enabled") != server.isEnabled())
|
||||
edits.set("enabled", this.servers.get().getMap("Servers").getMap(name).getBoolean("Enabled"));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getKeys().contains("Display") && ((this.servers.get().getMap("Servers").getMap(name).getRawString("Display").length() == 0 && !server.getName().equals(server.getDisplayName())) || (this.servers.get().getMap("Servers").getMap(name).getRawString("Display").length() > 0 && !this.servers.get().getMap("Servers").getMap(name).getRawString("Display").equals(server.getDisplayName()))))
|
||||
edits.set("display", this.servers.get().getMap("Servers").getMap(name).getRawString("Display"));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getKeys().contains("Display") && ((this.servers.get().getMap("Servers").getMap(name).getString("Display").length() == 0 && !server.getName().equals(server.getDisplayName())) || (this.servers.get().getMap("Servers").getMap(name).getString("Display").length() > 0 && !Util.unescapeJavaString(this.servers.get().getMap("Servers").getMap(name).getString("Display")).equals(server.getDisplayName()))))
|
||||
edits.set("display", Util.unescapeJavaString(this.servers.get().getMap("Servers").getMap(name).getString("Display")));
|
||||
if (!this.servers.get().getMap("Servers").getMap(name).getString("Host").equalsIgnoreCase(server.getHost().getName()))
|
||||
edits.set("host", this.servers.get().getMap("Servers").getMap(name).getRawString("Host"));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getKeys().contains("Template") && ((this.servers.get().getMap("Servers").getMap(name).getRawString("Template").length() == 0 && server.getTemplate() != null) || (this.servers.get().getMap("Servers").getMap(name).getRawString("Template").length() > 0 && server.getTemplate() == null) || (server.getTemplate() != null && !this.servers.get().getMap("Servers").getMap(name).getString("Template").equalsIgnoreCase(server.getTemplate().getName()))))
|
||||
edits.set("host", this.servers.get().getMap("Servers").getMap(name).getString("Host"));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getKeys().contains("Template") && ((this.servers.get().getMap("Servers").getMap(name).getString("Template").length() == 0 && server.getTemplate() != null) || (this.servers.get().getMap("Servers").getMap(name).getString("Template").length() > 0 && server.getTemplate() == null) || (server.getTemplate() != null && !this.servers.get().getMap("Servers").getMap(name).getString("Template").equalsIgnoreCase(server.getTemplate().getName()))))
|
||||
edits.set("template", this.servers.get().getMap("Servers").getMap(name).getString("Template"));
|
||||
if (!this.servers.get().getMap("Servers").getMap(name).getStringList("Group").equals(server.getGroups()))
|
||||
edits.set("group", this.servers.get().getMap("Servers").getMap(name).getRawStringList("Group"));
|
||||
edits.set("group", this.servers.get().getMap("Servers").getMap(name).getStringList("Group"));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getInt("Port") != server.getAddress().getPort())
|
||||
edits.set("port", this.servers.get().getMap("Servers").getMap(name).getInt("Port"));
|
||||
if (!(ChatColor.translateAlternateColorCodes('&', this.servers.get().getMap("Servers").getMap(name).getString("Motd")).equals(server.getMotd())))
|
||||
edits.set("motd", this.servers.get().getMap("Servers").getMap(name).getRawString("Motd"));
|
||||
if (!(ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(this.servers.get().getMap("Servers").getMap(name).getString("Motd"))).equals(server.getMotd())))
|
||||
edits.set("motd", this.servers.get().getMap("Servers").getMap(name).getString("Motd"));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getBoolean("Log") != server.isLogging())
|
||||
edits.set("log", this.servers.get().getMap("Servers").getMap(name).getBoolean("Log"));
|
||||
if (!this.servers.get().getMap("Servers").getMap(name).getRawString("Directory").equals(server.getPath()))
|
||||
edits.set("dir", this.servers.get().getMap("Servers").getMap(name).getRawString("Directory"));
|
||||
if (!this.servers.get().getMap("Servers").getMap(name).getRawString("Executable").equals(server.getExecutable()))
|
||||
edits.set("exec", this.servers.get().getMap("Servers").getMap(name).getRawString("Executable"));
|
||||
if (!this.servers.get().getMap("Servers").getMap(name).getRawString("Stop-Command").equals(server.getStopCommand()))
|
||||
edits.set("stop-cmd", this.servers.get().getMap("Servers").getMap(name).getRawString("Stop-Command"));
|
||||
SubServer.StopAction action = Try.all.get(() -> SubServer.StopAction.valueOf(this.servers.get().getMap("Servers").getMap(name).getRawString("Stop-Action", "NONE").toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
if (!this.servers.get().getMap("Servers").getMap(name).getString("Directory").equals(server.getPath()))
|
||||
edits.set("dir", this.servers.get().getMap("Servers").getMap(name).getString("Directory"));
|
||||
if (!this.servers.get().getMap("Servers").getMap(name).getString("Executable").equals(server.getExecutable()))
|
||||
edits.set("exec", this.servers.get().getMap("Servers").getMap(name).getString("Executable"));
|
||||
if (!this.servers.get().getMap("Servers").getMap(name).getString("Stop-Command").equals(server.getStopCommand()))
|
||||
edits.set("stop-cmd", this.servers.get().getMap("Servers").getMap(name).getString("Stop-Command"));
|
||||
SubServer.StopAction action = Try.all.get(() -> SubServer.StopAction.valueOf(this.servers.get().getMap("Servers").getMap(name).getString("Stop-Action", "NONE").toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
if (action != null && action != server.getStopAction())
|
||||
edits.set("stop-action", action.toString());
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getBoolean("Restricted") != server.isRestricted())
|
||||
@ -511,38 +511,38 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
if (server == null || // Server must be reset
|
||||
!this.servers.get().getMap("Servers").getMap(name).getString("Host").equalsIgnoreCase(server.getHost().getName()) ||
|
||||
this.servers.get().getMap("Servers").getMap(name).getInt("Port") != server.getAddress().getPort() ||
|
||||
!this.servers.get().getMap("Servers").getMap(name).getRawString("Directory").equals(server.getPath()) ||
|
||||
!this.servers.get().getMap("Servers").getMap(name).getRawString("Executable").equals(server.getExecutable())
|
||||
!this.servers.get().getMap("Servers").getMap(name).getString("Directory").equals(server.getPath()) ||
|
||||
!this.servers.get().getMap("Servers").getMap(name).getString("Executable").equals(server.getExecutable())
|
||||
) {
|
||||
if (server != null) server.getHost().forceRemoveSubServer(name);
|
||||
add = true;
|
||||
server = this.hosts.get(this.servers.get().getMap("Servers").getMap(name).getString("Host").toLowerCase()).constructSubServer(name, this.servers.get().getMap("Servers").getMap(name).getBoolean("Enabled"),
|
||||
this.servers.get().getMap("Servers").getMap(name).getInt("Port"), ChatColor.translateAlternateColorCodes('&', this.servers.get().getMap("Servers").getMap(name).getString("Motd")), this.servers.get().getMap("Servers").getMap(name).getBoolean("Log"),
|
||||
this.servers.get().getMap("Servers").getMap(name).getRawString("Directory"), this.servers.get().getMap("Servers").getMap(name).getRawString("Executable"), this.servers.get().getMap("Servers").getMap(name).getRawString("Stop-Command"),
|
||||
this.servers.get().getMap("Servers").getMap(name).getInt("Port"), ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(this.servers.get().getMap("Servers").getMap(name).getString("Motd"))), this.servers.get().getMap("Servers").getMap(name).getBoolean("Log"),
|
||||
this.servers.get().getMap("Servers").getMap(name).getString("Directory"), this.servers.get().getMap("Servers").getMap(name).getString("Executable"), this.servers.get().getMap("Servers").getMap(name).getString("Stop-Command"),
|
||||
this.servers.get().getMap("Servers").getMap(name).getBoolean("Hidden"), this.servers.get().getMap("Servers").getMap(name).getBoolean("Restricted"));
|
||||
} else { // Server doesn't need to reset
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getBoolean("Enabled") != server.isEnabled())
|
||||
server.setEnabled(this.servers.get().getMap("Servers").getMap(name).getBoolean("Enabled"));
|
||||
if (!ChatColor.translateAlternateColorCodes('&', this.servers.get().getMap("Servers").getMap(name).getString("Motd")).equals(server.getMotd()))
|
||||
server.setMotd(ChatColor.translateAlternateColorCodes('&', this.servers.get().getMap("Servers").getMap(name).getString("Motd")));
|
||||
if (!ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(this.servers.get().getMap("Servers").getMap(name).getString("Motd"))).equals(server.getMotd()))
|
||||
server.setMotd(ChatColor.translateAlternateColorCodes('&', Util.unescapeJavaString(this.servers.get().getMap("Servers").getMap(name).getString("Motd"))));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getBoolean("Log") != server.isLogging())
|
||||
server.setLogging(this.servers.get().getMap("Servers").getMap(name).getBoolean("Log"));
|
||||
if (!this.servers.get().getMap("Servers").getMap(name).getRawString("Stop-Command").equals(server.getStopCommand()))
|
||||
server.setStopCommand(this.servers.get().getMap("Servers").getMap(name).getRawString("Stop-Command"));
|
||||
if (!this.servers.get().getMap("Servers").getMap(name).getString("Stop-Command").equals(server.getStopCommand()))
|
||||
server.setStopCommand(this.servers.get().getMap("Servers").getMap(name).getString("Stop-Command"));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getBoolean("Restricted") != server.isRestricted())
|
||||
server.setRestricted(this.servers.get().getMap("Servers").getMap(name).getBoolean("Restricted"));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getBoolean("Hidden") != server.isHidden())
|
||||
server.setHidden(this.servers.get().getMap("Servers").getMap(name).getBoolean("Hidden"));
|
||||
} // Apply these changes regardless of reset
|
||||
SubServer.StopAction action = Try.all.get(() -> SubServer.StopAction.valueOf(this.servers.get().getMap("Servers").getMap(name).getRawString("Stop-Action", "NONE").toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
SubServer.StopAction action = Try.all.get(() -> SubServer.StopAction.valueOf(this.servers.get().getMap("Servers").getMap(name).getString("Stop-Action", "NONE").toUpperCase().replace('-', '_').replace(' ', '_')));
|
||||
if (action != null && action != server.getStopAction())
|
||||
server.setStopAction(action);
|
||||
if (!status && this.servers.get().getMap("Servers").getMap(name).getBoolean("Run-On-Launch"))
|
||||
autorun.add(name.toLowerCase());
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getKeys().contains("Display") && ((this.servers.get().getMap("Servers").getMap(name).getRawString("Display").length() == 0 && !server.getName().equals(server.getDisplayName())) || (this.servers.get().getMap("Servers").getMap(name).getRawString("Display").length() > 0 && !this.servers.get().getMap("Servers").getMap(name).getRawString("Display").equals(server.getDisplayName()))))
|
||||
server.setDisplayName(this.servers.get().getMap("Servers").getMap(name).getRawString("Display"));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getKeys().contains("Template") && ((this.servers.get().getMap("Servers").getMap(name).getRawString("Template").length() == 0 && server.getTemplate() != null) || (this.servers.get().getMap("Servers").getMap(name).getRawString("Template").length() > 0 && server.getTemplate() == null) || (server.getTemplate() != null && !this.servers.get().getMap("Servers").getMap(name).getString("Template").equalsIgnoreCase(server.getTemplate().getName()))))
|
||||
server.setTemplate(this.servers.get().getMap("Servers").getMap(name).getRawString("Template"));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getKeys().contains("Display") && ((this.servers.get().getMap("Servers").getMap(name).getString("Display").length() == 0 && !server.getName().equals(server.getDisplayName())) || (this.servers.get().getMap("Servers").getMap(name).getString("Display").length() > 0 && !Util.unescapeJavaString(this.servers.get().getMap("Servers").getMap(name).getString("Display")).equals(server.getDisplayName()))))
|
||||
server.setDisplayName(Util.unescapeJavaString(this.servers.get().getMap("Servers").getMap(name).getString("Display")));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getKeys().contains("Template") && ((this.servers.get().getMap("Servers").getMap(name).getString("Template").length() == 0 && server.getTemplate() != null) || (this.servers.get().getMap("Servers").getMap(name).getString("Template").length() > 0 && server.getTemplate() == null) || (server.getTemplate() != null && !this.servers.get().getMap("Servers").getMap(name).getString("Template").equalsIgnoreCase(server.getTemplate().getName()))))
|
||||
server.setTemplate(this.servers.get().getMap("Servers").getMap(name).getString("Template"));
|
||||
if (this.servers.get().getMap("Servers").getMap(name).getKeys().contains("Group")) {
|
||||
for (String group : server.getGroups()) server.removeGroup(group);
|
||||
for (String group : this.servers.get().getMap("Servers").getMap(name).getStringList("Group")) server.addGroup(group);
|
||||
@ -558,7 +558,7 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
}
|
||||
for (String name : ukeys) {
|
||||
SubServer server = api.getSubServer(name);
|
||||
for (String oname : this.servers.get().getMap("Servers").getMap(server.getName()).getRawStringList("Incompatible", new ArrayList<>())) {
|
||||
for (String oname : this.servers.get().getMap("Servers").getMap(server.getName()).getStringList("Incompatible", new ArrayList<>())) {
|
||||
SubServer oserver = api.getSubServer(oname);
|
||||
if (oserver != null && server.isCompatible(oserver)) server.toggleCompatibility(oserver);
|
||||
}
|
||||
@ -603,11 +603,11 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
|
||||
subprotocol.setTimeout(TimeUnit.SECONDS.toMillis(config.get().getMap("Settings").getMap("SubData").getInt("Timeout", 30)));
|
||||
|
||||
String cipher = config.get().getMap("Settings").getMap("SubData").getRawString("Encryption", "NULL");
|
||||
String cipher = config.get().getMap("Settings").getMap("SubData").getString("Encryption", "NULL");
|
||||
String[] ciphers = (cipher.contains("/"))?cipher.split("/"):new String[]{cipher};
|
||||
|
||||
if (ciphers[0].equals("AES") || ciphers[0].equals("AES-128") || ciphers[0].equals("AES-192") || ciphers[0].equals("AES-256")) {
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() == 0) {
|
||||
if (config.get().getMap("Settings").getMap("SubData").getString("Password", "").length() == 0) {
|
||||
byte[] bytes = new byte[32];
|
||||
new SecureRandom().nextBytes(bytes);
|
||||
String random = Base64.getUrlEncoder().withoutPadding().encodeToString(bytes);
|
||||
@ -616,10 +616,10 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
config.save();
|
||||
}
|
||||
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
|
||||
Logger.get("SubData").info("Encrypting SubData with AES:");
|
||||
Logger.get("SubData").info("Use the password field in config.yml to allow clients to connect");
|
||||
@ -642,9 +642,9 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
}
|
||||
|
||||
Logger.get("SubData").info("");
|
||||
subdata = subprotocol.open((config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0].equals("0.0.0.0"))?
|
||||
null:InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1]), cipher);
|
||||
subdata = subprotocol.open((config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[0].equals("0.0.0.0"))?
|
||||
null:InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[1]), cipher);
|
||||
}
|
||||
|
||||
// Add new entries to Allowed-Connections
|
||||
@ -727,9 +727,9 @@ public final class SubProxy extends BungeeCommon implements Listener {
|
||||
}
|
||||
|
||||
private void post() {
|
||||
if (!config.get().getMap("Settings").getRawStringList("Disabled-Overrides", Collections.emptyList()).contains("/server"))
|
||||
if (!config.get().getMap("Settings").getStringList("Disabled-Overrides", Collections.emptyList()).contains("/server"))
|
||||
getPluginManager().registerCommand(plugin, new SubCommand.BungeeServer(this, "server"));
|
||||
if (!config.get().getMap("Settings").getRawStringList("Disabled-Overrides", Collections.emptyList()).contains("/glist"))
|
||||
if (!config.get().getMap("Settings").getStringList("Disabled-Overrides", Collections.emptyList()).contains("/glist"))
|
||||
getPluginManager().registerCommand(plugin, new SubCommand.BungeeList(this, "glist"));
|
||||
|
||||
getPluginManager().registerCommand(plugin, new SubCommand(this, "subservers"));
|
||||
|
@ -63,12 +63,12 @@ public class ConfigUpdater {
|
||||
settings.set("Use-Title-Messages", updated.getMap("Settings", new YAMLSection()).getBoolean("Use-Title-Messages", true));
|
||||
settings.set("PlaceholderAPI-Ready", updated.getMap("Settings", new YAMLSection()).getBoolean("PlaceholderAPI-Ready", false));
|
||||
if (updated.getMap("Settings", new YAMLSection()).contains("PlaceholderAPI-Cache-Interval")) settings.set("PlaceholderAPI-Cache-Interval", updated.getMap("Settings").getInt("PlaceholderAPI-Cache-Interval"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).contains("Connect-Address")) settings.set("Connect-Address", updated.getMap("Settings").getRawString("Connect-Address"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).contains("Connect-Address")) settings.set("Connect-Address", updated.getMap("Settings").getString("Connect-Address"));
|
||||
|
||||
YAMLSection subdata = new YAMLSection();
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Name")) subdata.set("Name", updated.getMap("Settings").getMap("SubData").getRawString("Name"));
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getRawString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getRawString("Password"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Name")) subdata.set("Name", updated.getMap("Settings").getMap("SubData").getString("Name"));
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getString("Password"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Reconnect")) subdata.set("Reconnect", updated.getMap("Settings").getMap("SubData").getInt("Reconnect"));
|
||||
settings.set("SubData", subdata);
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class PacketCheckPermission implements Forwardable, PacketObjectIn<Intege
|
||||
|
||||
@Override
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,7 +48,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
if (plugin.isEnabled()) {
|
||||
Bukkit.getPluginManager().callEvent(new SubAddServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getRawString("host"):null, data.getString("server")));
|
||||
Bukkit.getPluginManager().callEvent(new SubAddServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getString("host"):null, data.getString("server")));
|
||||
callback("SubAddServerEvent", this);
|
||||
}
|
||||
}
|
||||
@ -131,7 +131,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
if (plugin.isEnabled()) {
|
||||
Bukkit.getPluginManager().callEvent(new SubRemoveServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getRawString("host"):null, data.getString("server")));
|
||||
Bukkit.getPluginManager().callEvent(new SubRemoveServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getString("host"):null, data.getString("server")));
|
||||
callback("SubRemoveServerEvent", this);
|
||||
}
|
||||
}
|
||||
|
@ -60,20 +60,20 @@ public class PacketLinkServer implements InitialPacket, PacketObjectIn<Integer>,
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||
if (data.getInt(0x0001) == 0) {
|
||||
try {
|
||||
if (data.contains(0x0000)) Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getRawString(0x0000));
|
||||
if (data.contains(0x0000)) Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getString(0x0000));
|
||||
setReady(client.getConnection());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
Bukkit.getLogger().info("SubData > Could not link name with server" + ((data.contains(0x0002))?": "+data.getRawString(0x0002):'.'));
|
||||
Bukkit.getLogger().info("SubData > Could not link name with server" + ((data.contains(0x0002))?": "+data.getString(0x0002):'.'));
|
||||
try {
|
||||
if (data.getInt(0x0001) == 2) {
|
||||
if (!plugin.config.get().getMap("Settings").getMap("SubData").contains("Name")) {
|
||||
plugin.config.get().getMap("Settings").getMap("SubData").set("Name", "");
|
||||
plugin.config.save();
|
||||
}
|
||||
if (plugin.config.get().getMap("Settings").getMap("SubData").getRawString("Name").length() <= 0)
|
||||
if (plugin.config.get().getMap("Settings").getMap("SubData").getString("Name").length() <= 0)
|
||||
Bukkit.getLogger().info("SubData > Use the server \"Name\" option to override auto-linking");
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
@ -96,13 +96,13 @@ public final class SubPlugin extends JavaPlugin {
|
||||
subprotocol.registerCipher("DHE-192", DHE.get(192));
|
||||
subprotocol.registerCipher("DHE-256", DHE.get(256));
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name", System.getenv("name"));
|
||||
server_address = config.get().getMap("Settings").getRawString("Connect-Address", System.getenv("address"));
|
||||
server_address = config.get().getMap("Settings").getString("Connect-Address", System.getenv("address"));
|
||||
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
if (config.get().getMap("Settings").getMap("SubData").getString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
|
||||
Bukkit.getLogger().info("SubData > AES Encryption Available");
|
||||
}
|
||||
@ -117,7 +117,7 @@ public final class SubPlugin extends JavaPlugin {
|
||||
|
||||
reconnect = true;
|
||||
Bukkit.getLogger().info("SubData > ");
|
||||
Bukkit.getLogger().info("SubData > Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
|
||||
Bukkit.getLogger().info("SubData > Connecting to /" + config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391"));
|
||||
connect(null);
|
||||
|
||||
gui = new DefaultUIHandler(this);
|
||||
@ -187,8 +187,8 @@ public final class SubPlugin extends JavaPlugin {
|
||||
public void run() {
|
||||
try {
|
||||
if (reset == resetDate && (subdata.getOrDefault(0, null) == null || subdata.get(0).isClosed())) {
|
||||
SubDataClient open = subprotocol.open(InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||
SubDataClient open = subprotocol.open(InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||
|
||||
if (subdata.getOrDefault(0, null) != null) subdata.get(0).reconnect(open);
|
||||
subdata.put(0, open);
|
||||
|
@ -18,13 +18,13 @@
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiUtil</artifactId>
|
||||
<version>21w44a</version>
|
||||
<version>21w44b</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ME1312.SubData</groupId>
|
||||
<artifactId>Client</artifactId>
|
||||
<version>21w43a</version>
|
||||
<version>21w44a</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -123,7 +123,7 @@ public class Host {
|
||||
*/
|
||||
public InetAddress getAddress() {
|
||||
try {
|
||||
return InetAddress.getByName(raw.getRawString("address"));
|
||||
return InetAddress.getByName(raw.getString("address"));
|
||||
} catch (UnknownHostException e) {
|
||||
throw new IllegalStateException("Invalid address response from raw data key: address");
|
||||
}
|
||||
@ -135,7 +135,7 @@ public class Host {
|
||||
* @return Host Directory Path
|
||||
*/
|
||||
public String getPath() {
|
||||
return raw.getRawString("dir");
|
||||
return raw.getString("dir");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,7 +144,7 @@ public class Host {
|
||||
* @return Host Name
|
||||
*/
|
||||
public String getName() {
|
||||
return raw.getRawString("name");
|
||||
return raw.getString("name");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -153,7 +153,7 @@ public class Host {
|
||||
* @return Display Name
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return raw.getRawString("display");
|
||||
return raw.getString("display");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -704,7 +704,7 @@ public class Host {
|
||||
* @return Object Signature
|
||||
*/
|
||||
public final String getSignature() {
|
||||
return raw.getRawString("signature");
|
||||
return raw.getString("signature");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,7 +90,7 @@ public class Proxy {
|
||||
* @return Name
|
||||
*/
|
||||
public String getName() {
|
||||
return raw.getRawString("name");
|
||||
return raw.getString("name");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,7 +99,7 @@ public class Proxy {
|
||||
* @return Display Name
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return raw.getRawString("display");
|
||||
return raw.getString("display");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,7 +119,7 @@ public class Proxy {
|
||||
public Collection<Pair<String, UUID>> getPlayers() {
|
||||
List<Pair<String, UUID>> players = new ArrayList<Pair<String, UUID>>();
|
||||
for (String id : raw.getMap("players").getKeys()) {
|
||||
players.add(new ContainedPair<String, UUID>(raw.getMap("players").getRawString(id), UUID.fromString(id)));
|
||||
players.add(new ContainedPair<String, UUID>(raw.getMap("players").getString(id), UUID.fromString(id)));
|
||||
}
|
||||
return players;
|
||||
}
|
||||
@ -165,7 +165,7 @@ public class Proxy {
|
||||
* @return Object Signature
|
||||
*/
|
||||
public final String getSignature() {
|
||||
return raw.getRawString("signature");
|
||||
return raw.getString("signature");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,7 +88,7 @@ public class RemotePlayer {
|
||||
* @return the player's username
|
||||
*/
|
||||
public String getName() {
|
||||
return raw.getRawString("name");
|
||||
return raw.getString("name");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,7 +97,7 @@ public class RemotePlayer {
|
||||
* @return the remote address
|
||||
*/
|
||||
public InetSocketAddress getAddress() {
|
||||
return new InetSocketAddress(raw.getRawString("address").split(":")[0], Integer.parseInt(raw.getRawString("address").split(":")[1]));
|
||||
return new InetSocketAddress(raw.getString("address").split(":")[0], Integer.parseInt(raw.getString("address").split(":")[1]));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +106,7 @@ public class RemotePlayer {
|
||||
* @return the proxy this player is connected to
|
||||
*/
|
||||
public String getProxyName() {
|
||||
return raw.getRawString("proxy");
|
||||
return raw.getString("proxy");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,8 +127,8 @@ public class RemotePlayer {
|
||||
}
|
||||
};
|
||||
|
||||
if (proxy == null || !proxy.getName().equalsIgnoreCase(raw.getRawString("proxy"))) {
|
||||
ClientAPI.getInstance().getProxy(raw.getRawString("proxy"), proxy -> {
|
||||
if (proxy == null || !proxy.getName().equalsIgnoreCase(raw.getString("proxy"))) {
|
||||
ClientAPI.getInstance().getProxy(raw.getString("proxy"), proxy -> {
|
||||
this.proxy = proxy;
|
||||
run.run();
|
||||
});
|
||||
@ -143,7 +143,7 @@ public class RemotePlayer {
|
||||
* @return the server this player is connected to
|
||||
*/
|
||||
public String getServerName() {
|
||||
return raw.getRawString("server");
|
||||
return raw.getString("server");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -164,8 +164,8 @@ public class RemotePlayer {
|
||||
}
|
||||
};
|
||||
|
||||
if (server == null || !server.getName().equalsIgnoreCase(raw.getRawString("server"))) {
|
||||
ClientAPI.getInstance().getServer(raw.getRawString("server"), server -> {
|
||||
if (server == null || !server.getName().equalsIgnoreCase(raw.getString("server"))) {
|
||||
ClientAPI.getInstance().getServer(raw.getString("server"), server -> {
|
||||
this.server = server;
|
||||
run.run();
|
||||
});
|
||||
|
@ -90,7 +90,7 @@ public class Server {
|
||||
* @return Server Name
|
||||
*/
|
||||
public String getName() {
|
||||
return raw.getRawString("name");
|
||||
return raw.getString("name");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,7 +99,7 @@ public class Server {
|
||||
* @return Display Name
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return raw.getRawString("display");
|
||||
return raw.getString("display");
|
||||
}
|
||||
/**
|
||||
* Get the Address of this Server
|
||||
@ -107,7 +107,7 @@ public class Server {
|
||||
* @return Server Address
|
||||
*/
|
||||
public InetSocketAddress getAddress() {
|
||||
return new InetSocketAddress(raw.getRawString("address").split(":")[0], Integer.parseInt(raw.getRawString("address").split(":")[1]));
|
||||
return new InetSocketAddress(raw.getString("address").split(":")[0], Integer.parseInt(raw.getString("address").split(":")[1]));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,7 +116,7 @@ public class Server {
|
||||
* @return Group names
|
||||
*/
|
||||
public List<String> getGroups() {
|
||||
return new LinkedList<String>(raw.getRawStringList("group"));
|
||||
return new LinkedList<String>(raw.getStringList("group"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,7 +127,7 @@ public class Server {
|
||||
public Collection<Pair<String, UUID>> getRemotePlayers() {
|
||||
List<Pair<String, UUID>> players = new ArrayList<Pair<String, UUID>>();
|
||||
for (String id : raw.getMap("players").getKeys()) {
|
||||
players.add(new ContainedPair<String, UUID>(raw.getMap("players").getRawString(id), UUID.fromString(id)));
|
||||
players.add(new ContainedPair<String, UUID>(raw.getMap("players").getString(id), UUID.fromString(id)));
|
||||
}
|
||||
return players;
|
||||
}
|
||||
@ -182,7 +182,7 @@ public class Server {
|
||||
* @return Server MOTD
|
||||
*/
|
||||
public String getMotd() {
|
||||
return raw.getRawString("motd");
|
||||
return raw.getString("motd");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -219,7 +219,7 @@ public class Server {
|
||||
* @return Object Signature
|
||||
*/
|
||||
public String getSignature() {
|
||||
return raw.getRawString("signature");
|
||||
return raw.getString("signature");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,7 +86,7 @@ public final class SimplifiedData {
|
||||
for (String group : data.getKeys()) {
|
||||
ArrayList<Server> servers = new ArrayList<Server>();
|
||||
for (String server : data.getMap(group).getKeys()) {
|
||||
if (data.getMap(group).getMap(server).getRawString("type", "Server").equals("SubServer")) {
|
||||
if (data.getMap(group).getMap(server).getString("type", "Server").equals("SubServer")) {
|
||||
servers.add(new SubServer(client, data.getMap(group).getMap(server)));
|
||||
} else {
|
||||
servers.add(new Server(client, data.getMap(group).getMap(server)));
|
||||
@ -138,7 +138,7 @@ public final class SimplifiedData {
|
||||
String key = new LinkedList<String>(data.getKeys()).getFirst();
|
||||
List<Server> servers = new LinkedList<Server>();
|
||||
for (String server : data.getMap(key).getKeys()) {
|
||||
if (data.getMap(key).getMap(server).getRawString("type", "Server").equals("SubServer")) {
|
||||
if (data.getMap(key).getMap(server).getString("type", "Server").equals("SubServer")) {
|
||||
servers.add(new SubServer(client, data.getMap(key).getMap(server)));
|
||||
} else {
|
||||
servers.add(new Server(client, data.getMap(key).getMap(server)));
|
||||
@ -169,7 +169,7 @@ public final class SimplifiedData {
|
||||
client(client).sendPacket(new PacketDownloadServerInfo(null, data -> {
|
||||
TreeMap<String, Server> servers = new TreeMap<String, Server>();
|
||||
for (String server : data.getKeys()) {
|
||||
if (data.getMap(server).getRawString("type", "Server").equals("SubServer")) {
|
||||
if (data.getMap(server).getString("type", "Server").equals("SubServer")) {
|
||||
servers.put(server.toLowerCase(), new SubServer(client, data.getMap(server)));
|
||||
} else {
|
||||
servers.put(server.toLowerCase(), new Server(client, data.getMap(server)));
|
||||
@ -200,7 +200,7 @@ public final class SimplifiedData {
|
||||
Server server = null;
|
||||
if (data.getKeys().size() > 0) {
|
||||
String key = new LinkedList<String>(data.getKeys()).getFirst();
|
||||
if (data.getMap(key).getRawString("type", "Server").equals("SubServer")) {
|
||||
if (data.getMap(key).getString("type", "Server").equals("SubServer")) {
|
||||
server = new SubServer(client, data.getMap(key));
|
||||
} else {
|
||||
server = new Server(client, data.getMap(key));
|
||||
|
@ -44,7 +44,7 @@ public class SubCreator {
|
||||
|
||||
public ServerTemplate(ObjectMap<String> raw) {
|
||||
this.raw = raw;
|
||||
this.type = Try.all.get(() -> ServerType.valueOf(raw.getRawString("type").toUpperCase().replace('-', '_').replace(' ', '_')), ServerType.CUSTOM);
|
||||
this.type = Try.all.get(() -> ServerType.valueOf(raw.getString("type").toUpperCase().replace('-', '_').replace(' ', '_')), ServerType.CUSTOM);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ public class SubCreator {
|
||||
* @return Template Name
|
||||
*/
|
||||
public String getName() {
|
||||
return raw.getRawString("name");
|
||||
return raw.getString("name");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,7 +62,7 @@ public class SubCreator {
|
||||
* @return Display Name
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return raw.getRawString("display");
|
||||
return raw.getString("display");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -391,7 +391,7 @@ public class SubServer extends Server {
|
||||
* @return The Host Name
|
||||
*/
|
||||
public String getHost() {
|
||||
return raw.getRawString("host");
|
||||
return raw.getString("host");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -412,8 +412,8 @@ public class SubServer extends Server {
|
||||
}
|
||||
};
|
||||
|
||||
if (host == null || !host.getName().equalsIgnoreCase(raw.getRawString("host"))) {
|
||||
ClientAPI.getInstance().getHost(raw.getRawString("host"), host -> {
|
||||
if (host == null || !host.getName().equalsIgnoreCase(raw.getString("host"))) {
|
||||
ClientAPI.getInstance().getHost(raw.getString("host"), host -> {
|
||||
this.host = host;
|
||||
run.run();
|
||||
});
|
||||
@ -428,7 +428,7 @@ public class SubServer extends Server {
|
||||
* @return The Template
|
||||
*/
|
||||
public String getTemplate() {
|
||||
return raw.getRawString("template");
|
||||
return raw.getString("template");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -523,7 +523,7 @@ public class SubServer extends Server {
|
||||
* @return Server Directory Path
|
||||
*/
|
||||
public String getPath() {
|
||||
return raw.getRawString("dir");
|
||||
return raw.getString("dir");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -532,7 +532,7 @@ public class SubServer extends Server {
|
||||
* @return Executable String
|
||||
*/
|
||||
public String getExecutable() {
|
||||
return raw.getRawString("exec");
|
||||
return raw.getString("exec");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -541,7 +541,7 @@ public class SubServer extends Server {
|
||||
* @return Stop Command
|
||||
*/
|
||||
public String getStopCommand() {
|
||||
return raw.getRawString("stop-cmd");
|
||||
return raw.getString("stop-cmd");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -575,7 +575,7 @@ public class SubServer extends Server {
|
||||
* @return Stop Action
|
||||
*/
|
||||
public StopAction getStopAction() {
|
||||
return Try.all.get(() -> StopAction.valueOf(raw.getRawString("stop-action").toUpperCase().replace('-', '_').replace(' ', '_')), StopAction.NONE);
|
||||
return Try.all.get(() -> StopAction.valueOf(raw.getString("stop-action").toUpperCase().replace('-', '_').replace(' ', '_')), StopAction.NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -652,7 +652,7 @@ public class SubServer extends Server {
|
||||
* @return Incompatibility List
|
||||
*/
|
||||
public List<String> getIncompatibilities() {
|
||||
return new LinkedList<String>(raw.getRawStringList("incompatible-list"));
|
||||
return new LinkedList<String>(raw.getStringList("incompatible-list"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -675,11 +675,11 @@ public class SubServer extends Server {
|
||||
|
||||
if (incompatibilities == null) {
|
||||
LinkedList<String> incompatible = new LinkedList<String>();
|
||||
for (String subserver : raw.getRawStringList("incompatible-list")) incompatible.add(subserver.toLowerCase());
|
||||
for (String subserver : raw.getStringList("incompatible-list")) incompatible.add(subserver.toLowerCase());
|
||||
client().sendPacket(new PacketDownloadServerInfo(incompatible, data -> {
|
||||
LinkedList<SubServer> incompatibilities = new LinkedList<SubServer>();
|
||||
for (String server : data.getKeys()) {
|
||||
if (data.getMap(server).getRawString("type", "Server").equals("SubServer")) incompatibilities.add(new SubServer(data.getMap(server)));
|
||||
if (data.getMap(server).getString("type", "Server").equals("SubServer")) incompatibilities.add(new SubServer(data.getMap(server)));
|
||||
}
|
||||
|
||||
this.incompatibilities = incompatibilities;
|
||||
@ -696,7 +696,7 @@ public class SubServer extends Server {
|
||||
* @return Current Incompatibility List
|
||||
*/
|
||||
public List<String> getCurrentIncompatibilities() {
|
||||
return new LinkedList<String>(raw.getRawStringList("incompatible"));
|
||||
return new LinkedList<String>(raw.getStringList("incompatible"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -719,11 +719,11 @@ public class SubServer extends Server {
|
||||
|
||||
if (currentIncompatibilities == null) {
|
||||
LinkedList<String> incompatible = new LinkedList<String>();
|
||||
for (String subserver : raw.getRawStringList("incompatible")) incompatible.add(subserver.toLowerCase());
|
||||
for (String subserver : raw.getStringList("incompatible")) incompatible.add(subserver.toLowerCase());
|
||||
client().sendPacket(new PacketDownloadServerInfo(incompatible, data -> {
|
||||
LinkedList<SubServer> incompatibilities = new LinkedList<SubServer>();
|
||||
for (String server : data.getKeys()) {
|
||||
if (data.getMap(server).getRawString("type", "Server").equals("SubServer")) incompatibilities.add(new SubServer(data.getMap(server)));
|
||||
if (data.getMap(server).getString("type", "Server").equals("SubServer")) incompatibilities.add(new SubServer(data.getMap(server)));
|
||||
}
|
||||
|
||||
this.currentIncompatibilities = incompatibilities;
|
||||
|
@ -59,12 +59,12 @@ public class ConfigUpdater {
|
||||
settings.set("Allow-Deletion", updated.getMap("Settings", new YAMLSection()).getBoolean("Allow-Deletion", false));
|
||||
settings.set("Show-Addresses", updated.getMap("Settings", new YAMLSection()).getBoolean("Show-Addresses", false));
|
||||
settings.set("Use-Title-Messages", updated.getMap("Settings", new YAMLSection()).getBoolean("Use-Title-Messages", true));
|
||||
if (updated.getMap("Settings", new YAMLSection()).contains("Connect-Address")) settings.set("Connect-Address", updated.getMap("Settings").getRawString("Connect-Address"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).contains("Connect-Address")) settings.set("Connect-Address", updated.getMap("Settings").getString("Connect-Address"));
|
||||
|
||||
YAMLSection subdata = new YAMLSection();
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Name")) subdata.set("Name", updated.getMap("Settings").getMap("SubData").getRawString("Name"));
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getRawString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getRawString("Password"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Name")) subdata.set("Name", updated.getMap("Settings").getMap("SubData").getString("Name"));
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getString("Password"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Reconnect")) subdata.set("Reconnect", updated.getMap("Settings").getMap("SubData").getInt("Reconnect"));
|
||||
settings.set("SubData", subdata);
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class PacketCheckPermission implements Forwardable, PacketObjectIn<Intege
|
||||
|
||||
@Override
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,7 +43,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
|
||||
callback("SubAddServerEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
Sponge.getEventManager().post(new SubAddServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getRawString("host"):null, data.getString("server")));
|
||||
Sponge.getEventManager().post(new SubAddServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getString("host"):null, data.getString("server")));
|
||||
callback("SubAddServerEvent", this);
|
||||
}
|
||||
});
|
||||
@ -108,7 +108,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
|
||||
callback("SubRemoveServerEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
Sponge.getEventManager().post(new SubRemoveServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getRawString("host"):null, data.getString("server")));
|
||||
Sponge.getEventManager().post(new SubRemoveServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getString("host"):null, data.getString("server")));
|
||||
callback("SubRemoveServerEvent", this);
|
||||
}
|
||||
});
|
||||
|
@ -64,20 +64,20 @@ public class PacketLinkServer implements InitialPacket, PacketObjectIn<Integer>,
|
||||
Logger log = Try.all.get(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client));
|
||||
if (data.getInt(0x0001) == 0) {
|
||||
try {
|
||||
if (data.contains(0x0000)) Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getRawString(0x0000));
|
||||
if (data.contains(0x0000)) Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getString(0x0000));
|
||||
setReady(client.getConnection());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
log.info("Could not link name with server" + ((data.contains(0x0002))?": "+data.getRawString(0x0002):'.'));
|
||||
log.info("Could not link name with server" + ((data.contains(0x0002))?": "+data.getString(0x0002):'.'));
|
||||
try {
|
||||
if (data.getInt(0x0001) == 2) {
|
||||
if (!plugin.config.get().getMap("Settings").getMap("SubData").contains("Name")) {
|
||||
plugin.config.get().getMap("Settings").getMap("SubData").set("Name", "");
|
||||
plugin.config.save();
|
||||
}
|
||||
if (plugin.config.get().getMap("Settings").getMap("SubData").getRawString("Name").length() <= 0)
|
||||
if (plugin.config.get().getMap("Settings").getMap("SubData").getString("Name").length() <= 0)
|
||||
log.info("Use the server \"Name\" option to override auto-linking");
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
@ -113,14 +113,14 @@ public final class SubPlugin {
|
||||
subprotocol.registerCipher("DHE-192", DHE.get(192));
|
||||
subprotocol.registerCipher("DHE-256", DHE.get(256));
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name", System.getenv("name"));
|
||||
server_address = config.get().getMap("Settings").getRawString("Connect-Address", System.getenv("address"));
|
||||
server_address = config.get().getMap("Settings").getString("Connect-Address", System.getenv("address"));
|
||||
Logger log = LoggerFactory.getLogger("SubData");
|
||||
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
if (config.get().getMap("Settings").getMap("SubData").getString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
|
||||
log.info("AES Encryption Available");
|
||||
}
|
||||
@ -135,7 +135,7 @@ public final class SubPlugin {
|
||||
|
||||
reconnect = true;
|
||||
log.info(" ");
|
||||
log.info("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
|
||||
log.info("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391"));
|
||||
connect(null);
|
||||
|
||||
//gui = new InternalUIHandler(this);
|
||||
@ -200,8 +200,8 @@ public final class SubPlugin {
|
||||
public void run() {
|
||||
try {
|
||||
if (reset == resetDate && (subdata.getOrDefault(0, null) == null || subdata.get(0).isClosed())) {
|
||||
SubDataClient open = subprotocol.open(InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||
SubDataClient open = subprotocol.open(InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||
|
||||
if (subdata.getOrDefault(0, null) != null) subdata.get(0).reconnect(open);
|
||||
subdata.put(0, open);
|
||||
|
@ -30,13 +30,13 @@
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiEngine</artifactId>
|
||||
<version>21w44a</version>
|
||||
<version>21w44b</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ME1312.Galaxi</groupId>
|
||||
<artifactId>GalaxiUI</artifactId>
|
||||
<version>21w44a</version>
|
||||
<version>21w44b</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -182,14 +182,14 @@ public final class ExHost {
|
||||
subprotocol.registerCipher("DHE-128", DHE.get(128));
|
||||
subprotocol.registerCipher("DHE-192", DHE.get(192));
|
||||
subprotocol.registerCipher("DHE-256", DHE.get(256));
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name", null);
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name");
|
||||
Logger log = new Logger("SubData");
|
||||
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
if (config.get().getMap("Settings").getMap("SubData").getString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
|
||||
log.info.println("AES Encryption Available");
|
||||
}
|
||||
@ -204,7 +204,7 @@ public final class ExHost {
|
||||
|
||||
reconnect = true;
|
||||
log.info.println();
|
||||
log.info.println("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
|
||||
log.info.println("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391"));
|
||||
connect(log.toPrimitive(), null);
|
||||
|
||||
new Metrics(this);
|
||||
@ -274,8 +274,8 @@ public final class ExHost {
|
||||
public void run() {
|
||||
try {
|
||||
if (reset == resetDate && (subdata.getOrDefault(0, null) == null || subdata.get(0).isClosed())) {
|
||||
SubDataClient open = subprotocol.open(InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||
SubDataClient open = subprotocol.open(InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||
|
||||
if (subdata.getOrDefault(0, null) != null) subdata.get(0).reconnect(open);
|
||||
subdata.put(0, open);
|
||||
|
@ -74,7 +74,7 @@ public class SubCreatorImpl {
|
||||
this.internal = internal;
|
||||
this.icon = icon;
|
||||
this.directory = directory;
|
||||
this.type = (build.contains("Server-Type"))?ServerType.valueOf(build.getRawString("Server-Type").toUpperCase()):ServerType.CUSTOM;
|
||||
this.type = (build.contains("Server-Type"))?ServerType.valueOf(build.getString("Server-Type").toUpperCase()):ServerType.CUSTOM;
|
||||
this.build = build;
|
||||
this.options = options;
|
||||
this.dynamic = dynamic;
|
||||
@ -227,7 +227,7 @@ public class SubCreatorImpl {
|
||||
tinfo.set("name", name);
|
||||
tinfo.set("display", name);
|
||||
tinfo.set("icon", icon);
|
||||
tinfo.set("type", (build.contains("Server-Type"))?ServerType.valueOf(build.getRawString("Server-Type").toUpperCase()):ServerType.CUSTOM);
|
||||
tinfo.set("type", (build.contains("Server-Type"))?ServerType.valueOf(build.getString("Server-Type").toUpperCase()):ServerType.CUSTOM);
|
||||
tinfo.set("version-req", build.getBoolean("Require-Version", false));
|
||||
tinfo.set("can-update", build.getBoolean("Can-Update", false));
|
||||
return tinfo;
|
||||
@ -247,9 +247,9 @@ public class SubCreatorImpl {
|
||||
try {
|
||||
if (file.isDirectory() && !file.getName().endsWith(".x")) {
|
||||
ObjectMap<String> config = (new File(file, "template.yml").exists())?new YAMLConfig(new File(file, "template.yml")).get().getMap("Template", new ObjectMap<String>()):new ObjectMap<String>();
|
||||
ServerTemplate template = new ServerTemplate(file.getName(), config.getBoolean("Enabled", true), config.getBoolean("Internal", false), config.getRawString("Icon", "::NULL::"), file, config.getMap("Build", new ObjectMap<String>()), config.getMap("Settings", new ObjectMap<String>()), false);
|
||||
ServerTemplate template = new ServerTemplate(file.getName(), config.getBoolean("Enabled", true), config.getBoolean("Internal", false), config.getString("Icon", "::NULL::"), file, config.getMap("Build", new ObjectMap<String>()), config.getMap("Settings", new ObjectMap<String>()), false);
|
||||
templates.put(file.getName().toLowerCase(), template);
|
||||
if (config.getKeys().contains("Display")) template.setDisplayName(config.getString("Display"));
|
||||
if (config.getKeys().contains("Display")) template.setDisplayName(Util.unescapeJavaString(config.getString("Display")));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
host.log.error.println("Couldn't load template: " + file.getName());
|
||||
@ -331,7 +331,7 @@ public class SubCreatorImpl {
|
||||
updateDirectory(template.getDirectory(), dir, template.getBuildOptions().getBoolean("Update-Files", false));
|
||||
|
||||
for (ObjectMapValue<String> replacement : template.getBuildOptions().getMap("Replacements", new ObjectMap<>()).getValues()) if (!replacement.isNull()) {
|
||||
replacements.put(replacement.getHandle().toLowerCase().replace('-', '_').replace(' ', '_'), replacement.asRawString());
|
||||
replacements.put(replacement.getHandle().toLowerCase().replace('-', '_').replace(' ', '_'), replacement.asString());
|
||||
}
|
||||
|
||||
var.putAll(replacements);
|
||||
@ -357,16 +357,16 @@ public class SubCreatorImpl {
|
||||
ObjectMap<String> spprofile = null;
|
||||
Version spversion = null;
|
||||
for (ObjectMap<String> profile : spversionmanifest.getMapList("versions")) {
|
||||
if (profile.getMap("dependencies").getRawString("minecraft").equalsIgnoreCase(version.toString()) && (spversion == null || new Version(profile.getRawString("version")).compareTo(spversion) >= 0)) {
|
||||
if (profile.getMap("dependencies").getString("minecraft").equalsIgnoreCase(version.toString()) && (spversion == null || new Version(profile.getString("version")).compareTo(spversion) >= 0)) {
|
||||
spprofile = profile;
|
||||
spversion = new Version(profile.getRawString("version"));
|
||||
spversion = new Version(profile.getString("version"));
|
||||
}
|
||||
}
|
||||
if (spversion == null) throw new InvalidServerException("Cannot find Sponge version for Minecraft " + version.toString());
|
||||
log.logger.info.println("Found \"sponge" + ((template.getType() == ServerType.FORGE)?"forge":"vanilla") + "-" + spversion.toString() + '"');
|
||||
|
||||
if (template.getType() == ServerType.FORGE) {
|
||||
Version mcfversion = new Version(((spprofile.getMap("dependencies").getRawString("forge").contains("-"))?"":spprofile.getMap("dependencies").getRawString("minecraft") + '-') + spprofile.getMap("dependencies").getRawString("forge"));
|
||||
Version mcfversion = new Version(((spprofile.getMap("dependencies").getString("forge").contains("-"))?"":spprofile.getMap("dependencies").getString("minecraft") + '-') + spprofile.getMap("dependencies").getString("forge"));
|
||||
log.logger.info.println("Found \"forge-" + mcfversion.toString() + '"');
|
||||
|
||||
var.put("mcf_version", mcfversion.toString());
|
||||
@ -390,7 +390,7 @@ public class SubCreatorImpl {
|
||||
|
||||
try {
|
||||
log.logger.info.println("Launching Build Script...");
|
||||
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(host.host.getRawString("Git-Bash"), template.getBuildOptions().getRawString("Executable"))).directory(dir);
|
||||
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(host.host.getString("Git-Bash"), template.getBuildOptions().getString("Executable"))).directory(dir);
|
||||
pb.environment().putAll(var);
|
||||
log.file = new File(dir, "SubCreator-" + template.getName() + "-" + ((version != null)?"-"+version.toString():"") + ".log");
|
||||
process = pb.start();
|
||||
@ -435,8 +435,8 @@ public class SubCreatorImpl {
|
||||
replacements.put("port", Integer.toString(port));
|
||||
};
|
||||
declaration.run();
|
||||
File dir = (update != null)?new File(update.getFullPath()):new File(host.host.getRawString("Directory"),
|
||||
(template.getConfigOptions().contains("Directory"))?new ReplacementScanner(replacements).replace(template.getConfigOptions().getRawString("Directory")).toString():name);
|
||||
File dir = (update != null)?new File(update.getFullPath()):new File(host.host.getString("Directory"),
|
||||
(template.getConfigOptions().contains("Directory"))?new ReplacementScanner(replacements).replace(template.getConfigOptions().getString("Directory")).toString():name);
|
||||
|
||||
ObjectMap<String> config;
|
||||
try {
|
||||
@ -459,7 +459,7 @@ public class SubCreatorImpl {
|
||||
|
||||
LinkedList<String> masks = new LinkedList<>();
|
||||
masks.add("/server.properties");
|
||||
masks.addAll(template.getBuildOptions().getRawStringList("Replace", Collections.emptyList()));
|
||||
masks.addAll(template.getBuildOptions().getStringList("Replace", Collections.emptyList()));
|
||||
replacements.replace(dir, masks.toArray(new String[0]));
|
||||
} catch (Exception e) {
|
||||
config = null;
|
||||
@ -546,7 +546,7 @@ public class SubCreatorImpl {
|
||||
private static Pair<YAMLSection, String> address = null;
|
||||
private String getAddress() {
|
||||
if (address == null || host.config.get() != address.key()) {
|
||||
address = new ContainedPair<>(host.config.get(), host.config.get().getMap("Settings").getRawString("Server-Bind"));
|
||||
address = new ContainedPair<>(host.config.get(), host.config.get().getMap("Settings").getString("Server-Bind"));
|
||||
}
|
||||
return address.value();
|
||||
}
|
||||
@ -555,8 +555,8 @@ public class SubCreatorImpl {
|
||||
private Map<String, Object> getSubData() {
|
||||
if (subdata == null || host.config.get() != subdata.key()) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("Address", host.config.get().getMap("Settings").getMap("SubData").getRawString("Address"));
|
||||
if (host.config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) map.put("Password", host.config.get().getMap("Settings").getMap("SubData").getRawString("Password"));
|
||||
map.put("Address", host.config.get().getMap("Settings").getMap("SubData").getString("Address"));
|
||||
if (host.config.get().getMap("Settings").getMap("SubData").getString("Password", "").length() > 0) map.put("Password", host.config.get().getMap("Settings").getMap("SubData").getString("Password"));
|
||||
subdata = new ContainedPair<>(host.config.get(), map);
|
||||
}
|
||||
return subdata.value();
|
||||
|
@ -60,7 +60,7 @@ public class SubServerImpl {
|
||||
this.port = port;
|
||||
this.log = new Container<Boolean>(log);
|
||||
this.dir = directory;
|
||||
this.directory = new File(host.host.getRawString("Directory"), directory);
|
||||
this.directory = new File(host.host.getString("Directory"), directory);
|
||||
this.executable = executable;
|
||||
this.process = null;
|
||||
this.logger = new SubLoggerImpl(null, this, name, null, this.log, null);
|
||||
@ -100,11 +100,11 @@ public class SubServerImpl {
|
||||
boolean falsestart = true;
|
||||
allowrestart = true;
|
||||
try {
|
||||
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(host.host.getRawString("Git-Bash"), executable)).directory(directory);
|
||||
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(host.host.getString("Git-Bash"), executable)).directory(directory);
|
||||
pb.environment().put("java", System.getProperty("java.home") + File.separator + "bin" + File.separator + "java");
|
||||
pb.environment().put("name", getName());
|
||||
if (SubAPI.getInstance().getSubDataNetwork()[0] != null) pb.environment().put("host", SubAPI.getInstance().getName());
|
||||
pb.environment().put("address", host.config.get().getMap("Settings").getRawString("Server-Bind"));
|
||||
pb.environment().put("address", host.config.get().getMap("Settings").getString("Server-Bind"));
|
||||
pb.environment().put("port", Integer.toString(getPort()));
|
||||
logger.init();
|
||||
process = pb.start();
|
||||
|
@ -64,16 +64,16 @@ public class ConfigUpdater {
|
||||
settings.set("Console-Log", updated.getMap("Settings", new YAMLSection()).getBoolean("Console-Log", true));
|
||||
settings.set("Network-Log", updated.getMap("Settings", new YAMLSection()).getBoolean("Network-Log", true));
|
||||
settings.set("Download-Templates", updated.getMap("Settings", new YAMLSection()).getBoolean("Download-Templates", true));
|
||||
settings.set("Server-Bind", updated.getMap("Settings", new YAMLSection()).getRawString("Server-Bind", "127.0.0.1"));
|
||||
settings.set("Server-Bind", updated.getMap("Settings", new YAMLSection()).getString("Server-Bind", "127.0.0.1"));
|
||||
|
||||
YAMLSection upnp = new YAMLSection();
|
||||
upnp.set("Forward-Servers", updated.getMap("Settings", new YAMLSection()).getMap("UPnP", new YAMLSection()).getBoolean("Forward-Servers", false));
|
||||
settings.set("UPnP", upnp);
|
||||
|
||||
YAMLSection subdata = new YAMLSection();
|
||||
subdata.set("Name", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getRawString("Name", "undefined"));
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getRawString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getRawString("Password"));
|
||||
subdata.set("Name", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getString("Name", "undefined"));
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getString("Password"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Reconnect")) subdata.set("Reconnect", updated.getMap("Settings").getMap("SubData").getInt("Reconnect"));
|
||||
settings.set("SubData", subdata);
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class PacketCheckPermission implements Forwardable, PacketObjectIn<Intege
|
||||
|
||||
@Override
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,13 +71,13 @@ public class PacketExAddServer implements PacketObjectIn<Integer>, PacketObjectO
|
||||
Logger logger = Try.all.get(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String name = data.getString(0x0001);
|
||||
boolean enabled = data.getBoolean(0x0002);
|
||||
int port = data.getInt(0x0003);
|
||||
boolean log = data.getBoolean(0x0004);
|
||||
String dir = data.getRawString(0x0005);
|
||||
String exec = data.getRawString(0x0006);
|
||||
String stopcmd = data.getRawString(0x0007);
|
||||
String dir = data.getString(0x0005);
|
||||
String exec = data.getString(0x0006);
|
||||
String stopcmd = data.getString(0x0007);
|
||||
UUID running = data.contains(0x0008)?data.getUUID(0x0008):null;
|
||||
|
||||
if (host.servers.keySet().contains(name.toLowerCase())) {
|
||||
|
@ -81,7 +81,7 @@ public class PacketExControlServer implements PacketObjectIn<Integer>, PacketObj
|
||||
@Override
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||
try {
|
||||
SubServerImpl server = host.servers.get(data.getRawString(0x0000).toLowerCase());
|
||||
SubServerImpl server = host.servers.get(data.getString(0x0000).toLowerCase());
|
||||
switch (data.getInt(0x0001)) {
|
||||
case 0:
|
||||
server.setEnabled(data.getList(0x0002).get(0).asBoolean());
|
||||
@ -90,7 +90,7 @@ public class PacketExControlServer implements PacketObjectIn<Integer>, PacketObj
|
||||
server.start(data.getList(0x0002).get(0).asUUID());
|
||||
break;
|
||||
case 2:
|
||||
server.command(data.getList(0x0002).get(0).asRawString());
|
||||
server.command(data.getList(0x0002).get(0).asString());
|
||||
break;
|
||||
case 3:
|
||||
server.stop();
|
||||
@ -105,7 +105,7 @@ public class PacketExControlServer implements PacketObjectIn<Integer>, PacketObj
|
||||
Util.reflect(SubLoggerImpl.class.getDeclaredField("address"), server.getLogger(), data.getList(0x0002).get(0).asUUID());
|
||||
break;
|
||||
case 7:
|
||||
server.setStopCommand(data.getList(0x0002).get(0).asRawString());
|
||||
server.setStopCommand(data.getList(0x0002).get(0).asString());
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -81,13 +81,13 @@ public class PacketExCreateServer implements PacketObjectIn<Integer>, PacketObje
|
||||
try {
|
||||
if (data.contains(0x0001)) {
|
||||
if (data.contains(0x0001)) {
|
||||
host.creator.terminate(data.getRawString(0x0001).toLowerCase());
|
||||
host.creator.terminate(data.getString(0x0001).toLowerCase());
|
||||
} else {
|
||||
host.creator.terminate();
|
||||
}
|
||||
client.sendPacket(new PacketExCreateServer(1, null, tracker));
|
||||
} else {
|
||||
String name = data.getRawString(0x0002);
|
||||
String name = data.getString(0x0002);
|
||||
ObjectMapValue<Integer> template = data.get(0x0003);
|
||||
Version version = (data.contains(0x0004)?data.getVersion(0x0004):null);
|
||||
Integer port = data.getInt(0x0005);
|
||||
@ -98,18 +98,18 @@ public class PacketExCreateServer implements PacketObjectIn<Integer>, PacketObje
|
||||
SubCreatorImpl.ServerTemplate templateV;
|
||||
|
||||
if (template.isString()) {
|
||||
templateV = host.templates.get(template.asRawString().toLowerCase());
|
||||
if (templateV == null) templateV = host.templatesR.get(template.asRawString().toLowerCase());
|
||||
templateV = host.templates.get(template.asString().toLowerCase());
|
||||
if (templateV == null) templateV = host.templatesR.get(template.asString().toLowerCase());
|
||||
} else {
|
||||
ObjectMap<String> templateM = template.asMap().key();
|
||||
templateV = new ServerTemplate(
|
||||
templateM.getRawString("name"),
|
||||
templateM.getString("name"),
|
||||
templateM.getBoolean("enabled"),
|
||||
templateM.getRawString("icon"),
|
||||
new File(templateM.getRawString("dir").replace('/', File.separatorChar)),
|
||||
templateM.getString("icon"),
|
||||
new File(templateM.getString("dir").replace('/', File.separatorChar)),
|
||||
templateM.getMap("build"),
|
||||
templateM.getMap("def"));
|
||||
templateV.setDisplayName(templateM.getRawString("display"));
|
||||
templateV.setDisplayName(templateM.getString("display"));
|
||||
}
|
||||
|
||||
host.creator.create(player, name, templateV, version, port, mode, log, tracker);
|
||||
|
@ -66,7 +66,7 @@ public class PacketExDeleteServer implements PacketObjectIn<Integer>, PacketObje
|
||||
Logger log = Try.all.get(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String name = data.getString(0x0001);
|
||||
YAMLSection info = new YAMLSection((Map<String, ?>) data.getObject(0x0002));
|
||||
boolean recycle = data.getBoolean(0x0003, false);
|
||||
|
||||
@ -80,7 +80,7 @@ public class PacketExDeleteServer implements PacketObjectIn<Integer>, PacketObje
|
||||
new Thread(() -> {
|
||||
File to = new File(GalaxiEngine.getInstance().getRuntimeDirectory(), "Recently Deleted/" + server.getName().toLowerCase());
|
||||
try {
|
||||
File from = new File(host.host.getRawString("Directory"), server.getPath());
|
||||
File from = new File(host.host.getString("Directory"), server.getPath());
|
||||
if (from.exists()) {
|
||||
log.info("Removing Files...");
|
||||
if (recycle) {
|
||||
|
@ -59,7 +59,7 @@ public class PacketExRemoveServer implements PacketObjectIn<Integer>, PacketObje
|
||||
Logger log = Try.all.get(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()));
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
try {
|
||||
String name = data.getRawString(0x0001);
|
||||
String name = data.getString(0x0001);
|
||||
if (!host.servers.keySet().contains(name.toLowerCase())) {
|
||||
((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketExRemoveServer(1, tracker));
|
||||
} else if (host.servers.get(name.toLowerCase()).isRunning()) {
|
||||
|
@ -26,100 +26,100 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
|
||||
callback("SubAddHostEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubAddHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubAddHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host")));
|
||||
callback("SubAddHostEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubAddProxyEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubAddProxyEvent(data.getRawString("proxy")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubAddProxyEvent(data.getString("proxy")));
|
||||
callback("SubAddProxyEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubAddServerEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubAddServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getRawString("host"):null, data.getRawString("server")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubAddServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getString("host"):null, data.getString("server")));
|
||||
callback("SubAddServerEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubCreateEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubCreateEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host"), data.getRawString("name"),
|
||||
data.getRawString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubCreateEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host"), data.getString("name"),
|
||||
data.getString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update")));
|
||||
callback("SubCreateEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubCreatedEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubCreatedEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host"), data.getRawString("name"),
|
||||
data.getRawString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update"), data.getBoolean("success")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubCreatedEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host"), data.getString("name"),
|
||||
data.getString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update"), data.getBoolean("success")));
|
||||
callback("SubCreatedEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubSendCommandEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubSendCommandEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), data.getRawString("command")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubSendCommandEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), data.getString("command")));
|
||||
callback("SubSendCommandEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubEditServerEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubEditServerEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), new ContainedPair<String, Object>(data.getRawString("edit"), data.get("value"))));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubEditServerEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), new ContainedPair<String, Object>(data.getString("edit"), data.get("value"))));
|
||||
callback("SubEditServerEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStartEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStartEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStartEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server")));
|
||||
callback("SubStartEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStartedEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStartedEvent(data.getRawString("server")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStartedEvent(data.getString("server")));
|
||||
callback("SubStartedEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStopEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStopEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), data.getBoolean("force")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStopEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), data.getBoolean("force")));
|
||||
callback("SubStopEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStoppedEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStoppedEvent(data.getRawString("server")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStoppedEvent(data.getString("server")));
|
||||
callback("SubStoppedEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubRemoveServerEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubRemoveServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getRawString("host"):null, data.getRawString("server")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubRemoveServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getString("host"):null, data.getString("server")));
|
||||
callback("SubRemoveServerEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubRemoveProxyEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubAddProxyEvent(data.getRawString("proxy")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubAddProxyEvent(data.getString("proxy")));
|
||||
callback("SubRemoveProxyEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubRemoveHostEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubRemoveHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host")));
|
||||
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubRemoveHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host")));
|
||||
callback("SubRemoveHostEvent", this);
|
||||
}
|
||||
});
|
||||
|
@ -56,7 +56,7 @@ public class PacketLinkExHost implements InitialPacket, PacketObjectIn<Integer>,
|
||||
if (data.getInt(0x0001) == 0) {
|
||||
setReady(client.getConnection());
|
||||
} else {
|
||||
log.severe("Could not link name with host" + ((data.contains(0x0002))?": "+data.getRawString(0x0002):'.'));
|
||||
log.severe("Could not link name with host" + ((data.contains(0x0002))?": "+data.getString(0x0002):'.'));
|
||||
DebugUtil.logException(new IllegalStateException(), log);
|
||||
GalaxiEngine.getInstance().stop();
|
||||
}
|
||||
|
@ -185,13 +185,13 @@ public final class ExProxy extends BungeeCommon implements Listener {
|
||||
subprotocol.unregisterCipher("AES-256");
|
||||
subprotocol.unregisterCipher("RSA");
|
||||
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name", null);
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name");
|
||||
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
if (config.get().getMap("Settings").getMap("SubData").getString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
|
||||
Logger.get("SubData").info("AES Encryption Available");
|
||||
}
|
||||
@ -206,7 +206,7 @@ public final class ExProxy extends BungeeCommon implements Listener {
|
||||
|
||||
reconnect = true;
|
||||
Logger.get("SubData").info("");
|
||||
Logger.get("SubData").info("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
|
||||
Logger.get("SubData").info("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391"));
|
||||
connect(Logger.get("SubData"), null);
|
||||
|
||||
if (UPnP.isUPnPAvailable()) {
|
||||
@ -239,8 +239,8 @@ public final class ExProxy extends BungeeCommon implements Listener {
|
||||
public void run() {
|
||||
try {
|
||||
if (reset == resetDate && (subdata.getOrDefault(0, null) == null || subdata.get(0).isClosed())) {
|
||||
SubDataClient open = subprotocol.open(InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||
SubDataClient open = subprotocol.open(InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||
|
||||
if (subdata.getOrDefault(0, null) != null) subdata.get(0).reconnect(open);
|
||||
subdata.put(0, open);
|
||||
@ -255,9 +255,9 @@ public final class ExProxy extends BungeeCommon implements Listener {
|
||||
}
|
||||
|
||||
private void post() {
|
||||
if (!config.get().getMap("Settings").getRawStringList("Disabled-Overrides", Collections.emptyList()).contains("/server"))
|
||||
if (!config.get().getMap("Settings").getStringList("Disabled-Overrides", Collections.emptyList()).contains("/server"))
|
||||
getPluginManager().registerCommand(plugin, new SubCommand.BungeeServer(this, "server"));
|
||||
if (!config.get().getMap("Settings").getRawStringList("Disabled-Overrides", Collections.emptyList()).contains("/glist"))
|
||||
if (!config.get().getMap("Settings").getStringList("Disabled-Overrides", Collections.emptyList()).contains("/glist"))
|
||||
getPluginManager().registerCommand(plugin, new SubCommand.BungeeList(this, "glist"));
|
||||
|
||||
getPluginManager().registerCommand(plugin, new SubCommand(this, "subservers"));
|
||||
|
@ -74,8 +74,8 @@ public class ConfigUpdater {
|
||||
if (i > 0) {
|
||||
YAMLSection settings = new YAMLSection();
|
||||
settings.set("Version", ((now.compareTo(was) <= 0)?was:now).toString());
|
||||
if (updated.getMap("Settings", new YAMLSection()).contains("RPEC-Check-Interval")) settings.set("RPEC-Check-Interval", updated.getMap("Settings").getRawString("RPEC-Check-Interval"));
|
||||
settings.set("Disabled-Overrides", updated.getMap("Settings", new YAMLSection()).getRawStringList("Disabled-Overrides", Collections.emptyList()));
|
||||
if (updated.getMap("Settings", new YAMLSection()).contains("RPEC-Check-Interval")) settings.set("RPEC-Check-Interval", updated.getMap("Settings").getString("RPEC-Check-Interval"));
|
||||
settings.set("Disabled-Overrides", updated.getMap("Settings", new YAMLSection()).getStringList("Disabled-Overrides", Collections.emptyList()));
|
||||
|
||||
YAMLSection smart_fallback = new YAMLSection();
|
||||
smart_fallback.set("Enabled", updated.getMap("Settings", new YAMLSection()).getMap("Smart-Fallback", new YAMLSection()).getBoolean("Enabled", true));
|
||||
@ -89,9 +89,9 @@ public class ConfigUpdater {
|
||||
settings.set("UPnP", upnp);
|
||||
|
||||
YAMLSection subdata = new YAMLSection();
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Name")) subdata.set("Name", updated.getMap("Settings").getMap("SubData").getRawString("Name"));
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getRawString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getRawString("Password"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Name")) subdata.set("Name", updated.getMap("Settings").getMap("SubData").getString("Name"));
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getString("Password"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Reconnect")) subdata.set("Reconnect", updated.getMap("Settings").getMap("SubData").getInt("Reconnect"));
|
||||
settings.set("SubData", subdata);
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class PacketCheckPermission implements Forwardable, PacketObjectIn<Intege
|
||||
|
||||
@Override
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,7 @@ public class PacketExDisconnectPlayer implements PacketObjectIn<Integer>, Packet
|
||||
ProxiedPlayer local;
|
||||
if ((local = plugin.getPlayer(id)) != null) {
|
||||
if (data.contains(0x0002)) {
|
||||
local.disconnect(data.getRawString(0x0002));
|
||||
local.disconnect(data.getString(0x0002));
|
||||
} else local.disconnect();
|
||||
} else {
|
||||
++failures;
|
||||
|
@ -58,9 +58,9 @@ public class PacketExMessagePlayer implements PacketObjectIn<Integer>, PacketObj
|
||||
BaseComponent[][] components = null;
|
||||
|
||||
if (data.contains(0x0002))
|
||||
legacy = data.getRawStringList(0x0002).toArray(new String[0]);
|
||||
legacy = data.getStringList(0x0002).toArray(new String[0]);
|
||||
if (data.contains(0x0003)) {
|
||||
List<String> messages = data.getRawStringList(0x0003);
|
||||
List<String> messages = data.getStringList(0x0003);
|
||||
components = new BaseComponent[messages.size()][];
|
||||
for (int i = 0; i < components.length; ++i) components[i] = ComponentSerializer.parse(messages.get(i));
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class PacketExSyncPlayer implements PacketObjectIn<Integer>, PacketObject
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||
String proxy = (data.contains(0x0000)?data.getRawString(0x0000).toLowerCase():null);
|
||||
String proxy = (data.contains(0x0000)?data.getString(0x0000).toLowerCase():null);
|
||||
synchronized (plugin.rPlayers) {
|
||||
if (data.getBoolean(0x0001) == null) {
|
||||
for (UUID id : Util.getBackwards(plugin.rPlayerLinkP, proxy)) {
|
||||
|
@ -51,7 +51,7 @@ public class PacketExTransferPlayer implements PacketObjectIn<Integer>, PacketOb
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
List<UUID> ids = data.getUUIDList(0x0001);
|
||||
try {
|
||||
ServerImpl server = plugin.servers.getOrDefault(data.getRawString(0x0002).toLowerCase(), null);
|
||||
ServerImpl server = plugin.servers.getOrDefault(data.getString(0x0002).toLowerCase(), null);
|
||||
if (server != null) {
|
||||
int failures = 0;
|
||||
for (UUID id : ids) {
|
||||
|
@ -21,14 +21,14 @@ public class PacketInExEditServer implements PacketObjectIn<Integer> {
|
||||
|
||||
@Override
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||
if (plugin.servers.containsKey(data.getRawString(0x0000).toLowerCase())) {
|
||||
ServerImpl server = plugin.servers.get(data.getRawString(0x0000).toLowerCase());
|
||||
if (plugin.servers.containsKey(data.getString(0x0000).toLowerCase())) {
|
||||
ServerImpl server = plugin.servers.get(data.getString(0x0000).toLowerCase());
|
||||
switch (data.getInt(0x0001)) {
|
||||
case 0:
|
||||
server.setDisplayName(data.getList(0x0002).get(0).asRawString());
|
||||
server.setDisplayName(data.getList(0x0002).get(0).asString());
|
||||
break;
|
||||
case 1:
|
||||
server.setMotd(data.getList(0x0002).get(0).asRawString());
|
||||
server.setMotd(data.getList(0x0002).get(0).asString());
|
||||
break;
|
||||
case 2:
|
||||
server.setRestricted(data.getList(0x0002).get(0).asBoolean());
|
||||
|
@ -28,100 +28,100 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
|
||||
callback("SubAddHostEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubAddHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubAddHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host")));
|
||||
callback("SubAddHostEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubAddProxyEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubAddProxyEvent(data.getRawString("proxy")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubAddProxyEvent(data.getString("proxy")));
|
||||
callback("SubAddProxyEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubAddServerEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubAddServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getRawString("host"):null, data.getRawString("server")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubAddServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getString("host"):null, data.getString("server")));
|
||||
callback("SubAddServerEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubCreateEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubCreateEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host"), data.getRawString("name"),
|
||||
data.getRawString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubCreateEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host"), data.getString("name"),
|
||||
data.getString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update")));
|
||||
callback("SubCreateEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubCreatedEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubCreatedEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host"), data.getRawString("name"),
|
||||
data.getRawString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update"), data.getBoolean("success")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubCreatedEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host"), data.getString("name"),
|
||||
data.getString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update"), data.getBoolean("success")));
|
||||
callback("SubCreatedEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubSendCommandEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubSendCommandEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), data.getRawString("command")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubSendCommandEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), data.getString("command")));
|
||||
callback("SubSendCommandEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubEditServerEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubEditServerEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), new ContainedPair<String, Object>(data.getRawString("edit"), data.get("value"))));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubEditServerEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), new ContainedPair<String, Object>(data.getString("edit"), data.get("value"))));
|
||||
callback("SubEditServerEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStartEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubStartEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubStartEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server")));
|
||||
callback("SubStartEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStartedEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubStartedEvent(data.getRawString("server")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubStartedEvent(data.getString("server")));
|
||||
callback("SubStartedEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStopEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubStopEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), data.getBoolean("force")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubStopEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), data.getBoolean("force")));
|
||||
callback("SubStopEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStoppedEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubStoppedEvent(data.getRawString("server")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubStoppedEvent(data.getString("server")));
|
||||
callback("SubStoppedEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubRemoveServerEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubRemoveServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getRawString("host"):null, data.getRawString("server")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubRemoveServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getString("host"):null, data.getString("server")));
|
||||
callback("SubRemoveServerEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubRemoveProxyEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubAddProxyEvent(data.getRawString("proxy")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubAddProxyEvent(data.getString("proxy")));
|
||||
callback("SubRemoveProxyEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubRemoveHostEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubRemoveHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host")));
|
||||
ProxyServer.getInstance().getPluginManager().callEvent(new SubRemoveHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host")));
|
||||
callback("SubRemoveHostEvent", this);
|
||||
}
|
||||
});
|
||||
|
@ -50,20 +50,20 @@ public class PacketLinkProxy implements InitialPacket, PacketObjectIn<Integer>,
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||
if (data.getInt(0x0001) == 0) {
|
||||
try {
|
||||
if (data.contains(0x0000)) Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getRawString(0x0000));
|
||||
if (data.contains(0x0000)) Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getString(0x0000));
|
||||
setReady(client.getConnection());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
Logger.get("SubData").info("Could not link name with proxy" + ((data.contains(0x0002))?": "+data.getRawString(0x0002):'.'));
|
||||
Logger.get("SubData").info("Could not link name with proxy" + ((data.contains(0x0002))?": "+data.getString(0x0002):'.'));
|
||||
try {
|
||||
if (data.getInt(0x0001) == 2) {
|
||||
if (!plugin.config.get().getMap("Settings").getMap("SubData").contains("Name")) {
|
||||
plugin.config.get().getMap("Settings").getMap("SubData").set("Name", "");
|
||||
plugin.config.save();
|
||||
}
|
||||
if (plugin.config.get().getMap("Settings").getMap("SubData").getRawString("Name").length() <= 0)
|
||||
if (plugin.config.get().getMap("Settings").getMap("SubData").getString("Name").length() <= 0)
|
||||
Logger.get("SubData").info("Use the proxy \"Name\" option to override auto-linking");
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
@ -169,11 +169,11 @@ public class SubProtocol extends SubDataProtocol {
|
||||
LinkedList<ListenerInfo> listeners = new LinkedList<ListenerInfo>(plugin.getConfig().getListeners());
|
||||
for (int i = 0; i < platform.getMap("bungee").getMapList("listeners").size(); i++) if (i < listeners.size()) {
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Forced-Hosts", true)) Util.reflect(ListenerInfo.class.getDeclaredField("forcedHosts"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getMap("forced-hosts").get());
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Motd", false)) Util.reflect(ListenerInfo.class.getDeclaredField("motd"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getRawString("motd"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Motd", false)) Util.reflect(ListenerInfo.class.getDeclaredField("motd"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getString("motd"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Player-Limit", false)) Util.reflect(ListenerInfo.class.getDeclaredField("maxPlayers"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getInt("player-limit"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Server-Priorities", true)) Util.reflect(ListenerInfo.class.getDeclaredField("serverPriority"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getRawStringList("priorities"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Server-Priorities", true)) Util.reflect(ListenerInfo.class.getDeclaredField("serverPriority"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getStringList("priorities"));
|
||||
}
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Disabled-Commands", false)) Util.reflect(Configuration.class.getDeclaredField("disabledCommands"), plugin.getConfig(), platform.getMap("bungee").getRawStringList("disabled-cmds"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Disabled-Commands", false)) Util.reflect(Configuration.class.getDeclaredField("disabledCommands"), plugin.getConfig(), platform.getMap("bungee").getStringList("disabled-cmds"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Player-Limit", false)) Util.reflect(Configuration.class.getDeclaredField("playerLimit"), plugin.getConfig(), platform.getMap("bungee").getInt("player-limit"));
|
||||
} catch (Exception e) {
|
||||
net.ME1312.SubServers.Bungee.Library.Compatibility.Logger.get("SubServers").info("Problem syncing BungeeCord configuration options");
|
||||
|
@ -160,13 +160,13 @@ public class ExProxy {
|
||||
subprotocol.unregisterCipher("AES-256");
|
||||
subprotocol.unregisterCipher("RSA");
|
||||
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name", null);
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name");
|
||||
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
if (config.get().getMap("Settings").getMap("SubData").getString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getString("Password")));
|
||||
|
||||
Logger.get("SubData").info("AES Encryption Available");
|
||||
}
|
||||
@ -181,7 +181,7 @@ public class ExProxy {
|
||||
|
||||
reconnect = true;
|
||||
Logger.get("SubData").info("");
|
||||
Logger.get("SubData").info("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
|
||||
Logger.get("SubData").info("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391"));
|
||||
connect(Logger.get("SubData"), null);
|
||||
|
||||
if (!posted) {
|
||||
@ -204,8 +204,8 @@ public class ExProxy {
|
||||
public void run() {
|
||||
try {
|
||||
if (reset == resetDate && (subdata.getOrDefault(0, null) == null || subdata.get(0).isClosed())) {
|
||||
SubDataClient open = subprotocol.open(InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||
SubDataClient open = subprotocol.open(InetAddress.getByName(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[0]),
|
||||
Integer.parseInt(config.get().getMap("Settings").getMap("SubData").getString("Address", "127.0.0.1:4391").split(":")[1]));
|
||||
|
||||
if (subdata.getOrDefault(0, null) != null) subdata.get(0).reconnect(open);
|
||||
subdata.put(0, open);
|
||||
@ -220,9 +220,9 @@ public class ExProxy {
|
||||
}
|
||||
|
||||
private void post() {
|
||||
if (!config.get().getMap("Settings").getRawStringList("Disabled-Overrides", Collections.emptyList()).contains("/server"))
|
||||
if (!config.get().getMap("Settings").getStringList("Disabled-Overrides", Collections.emptyList()).contains("/server"))
|
||||
proxy.getCommandManager().register("server", new SubCommand.BungeeServer(this));
|
||||
if (!config.get().getMap("Settings").getRawStringList("Disabled-Overrides", Collections.emptyList()).contains("/glist"))
|
||||
if (!config.get().getMap("Settings").getStringList("Disabled-Overrides", Collections.emptyList()).contains("/glist"))
|
||||
proxy.getCommandManager().register("glist", new SubCommand.BungeeList(this));
|
||||
|
||||
proxy.getCommandManager().register("subservers", new SubCommand(this), "subserver", "sub");
|
||||
|
@ -74,8 +74,8 @@ public class ConfigUpdater {
|
||||
if (i > 0) {
|
||||
YAMLSection settings = new YAMLSection();
|
||||
settings.set("Version", ((now.compareTo(was) <= 0)?was:now).toString());
|
||||
if (updated.getMap("Settings", new YAMLSection()).contains("RPEC-Check-Interval")) settings.set("RPEC-Check-Interval", updated.getMap("Settings").getRawString("RPEC-Check-Interval"));
|
||||
settings.set("Disabled-Overrides", updated.getMap("Settings", new YAMLSection()).getRawStringList("Disabled-Overrides", Collections.emptyList()));
|
||||
if (updated.getMap("Settings", new YAMLSection()).contains("RPEC-Check-Interval")) settings.set("RPEC-Check-Interval", updated.getMap("Settings").getString("RPEC-Check-Interval"));
|
||||
settings.set("Disabled-Overrides", updated.getMap("Settings", new YAMLSection()).getStringList("Disabled-Overrides", Collections.emptyList()));
|
||||
|
||||
YAMLSection smart_fallback = new YAMLSection();
|
||||
smart_fallback.set("Enabled", updated.getMap("Settings", new YAMLSection()).getMap("Smart-Fallback", new YAMLSection()).getBoolean("Enabled", true));
|
||||
@ -89,9 +89,9 @@ public class ConfigUpdater {
|
||||
settings.set("UPnP", upnp);
|
||||
|
||||
YAMLSection subdata = new YAMLSection();
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Name")) subdata.set("Name", updated.getMap("Settings").getMap("SubData").getRawString("Name"));
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getRawString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getRawString("Password"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Name")) subdata.set("Name", updated.getMap("Settings").getMap("SubData").getString("Name"));
|
||||
subdata.set("Address", updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).getString("Address", "127.0.0.1:4391"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Password")) subdata.set("Password", updated.getMap("Settings").getMap("SubData").getString("Password"));
|
||||
if (updated.getMap("Settings", new YAMLSection()).getMap("SubData", new YAMLSection()).contains("Reconnect")) subdata.set("Reconnect", updated.getMap("Settings").getMap("SubData").getInt("Reconnect"));
|
||||
settings.set("SubData", subdata);
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class PacketCheckPermission implements Forwardable, PacketObjectIn<Intege
|
||||
|
||||
@Override
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getRawString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
client.sendPacket(new PacketCheckPermissionResponse(data.getUUID(0x0001), data.getString(0x0002), (data.contains(0x0000))?data.getUUID(0x0000):null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,7 +54,7 @@ public class PacketExDisconnectPlayer implements PacketObjectIn<Integer>, Packet
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
List<UUID> ids = data.getUUIDList(0x0001);
|
||||
try {
|
||||
Component message = (data.contains(0x0002))? ChatColor.convertColor(data.getRawString(0x0002)) : Component.text().build();
|
||||
Component message = (data.contains(0x0002))? ChatColor.convertColor(data.getString(0x0002)) : Component.text().build();
|
||||
int failures = 0;
|
||||
for (UUID id : ids) {
|
||||
Optional<Player> local = ExProxy.getInstance().getPlayer(id);
|
||||
|
@ -59,12 +59,12 @@ public class PacketExMessagePlayer implements PacketObjectIn<Integer>, PacketObj
|
||||
Component[] components = null;
|
||||
|
||||
if (data.contains(0x0002)) {
|
||||
List<String> messages = data.getRawStringList(0x0002);
|
||||
List<String> messages = data.getStringList(0x0002);
|
||||
legacy = new Component[messages.size()];
|
||||
for (int i = 0; i < legacy.length; ++i) legacy[i] = ChatColor.convertColor(messages.get(i));
|
||||
}
|
||||
if (data.contains(0x0003)) {
|
||||
List<String> messages = data.getRawStringList(0x0003);
|
||||
List<String> messages = data.getStringList(0x0003);
|
||||
components = new Component[messages.size()];
|
||||
for (int i = 0; i < components.length; ++i) components[i] = GsonComponentSerializer.gson().deserialize(messages.get(i));
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class PacketExSyncPlayer implements PacketObjectIn<Integer>, PacketObject
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||
String proxy = (data.contains(0x0000)?data.getRawString(0x0000).toLowerCase():null);
|
||||
String proxy = (data.contains(0x0000)?data.getString(0x0000).toLowerCase():null);
|
||||
synchronized (plugin.rPlayers) {
|
||||
if (data.getBoolean(0x0001) == null) {
|
||||
for (UUID id : Util.getBackwards(plugin.rPlayerLinkP, proxy)) {
|
||||
|
@ -52,7 +52,7 @@ public class PacketExTransferPlayer implements PacketObjectIn<Integer>, PacketOb
|
||||
UUID tracker = (data.contains(0x0000)?data.getUUID(0x0000):null);
|
||||
List<UUID> ids = data.getUUIDList(0x0001);
|
||||
try {
|
||||
Optional<RegisteredServer> server = ExProxy.getInstance().getServer(data.getRawString(0x0002).toLowerCase());
|
||||
Optional<RegisteredServer> server = ExProxy.getInstance().getServer(data.getString(0x0002).toLowerCase());
|
||||
if (server.isPresent()) {
|
||||
int failures = 0;
|
||||
for (UUID id : ids) {
|
||||
|
@ -24,14 +24,14 @@ public class PacketInExEditServer implements PacketObjectIn<Integer> {
|
||||
|
||||
@Override
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||
ServerData server = ExProxy.getInstance().getServer(data.getRawString(0x0000)).map(RegisteredServer::getServerInfo).map(plugin::getData).orElse(null);
|
||||
ServerData server = ExProxy.getInstance().getServer(data.getString(0x0000)).map(RegisteredServer::getServerInfo).map(plugin::getData).orElse(null);
|
||||
if (server != null) {
|
||||
switch (data.getInt(0x0001)) {
|
||||
case 0:
|
||||
server.setDisplayName(data.getList(0x0002).get(0).asRawString());
|
||||
server.setDisplayName(data.getList(0x0002).get(0).asString());
|
||||
break;
|
||||
case 1:
|
||||
server.setMotd(ChatColor.parseColor('&', data.getList(0x0002).get(0).asRawString()));
|
||||
server.setMotd(ChatColor.parseColor('&', data.getList(0x0002).get(0).asString()));
|
||||
break;
|
||||
case 2:
|
||||
server.setRestricted(data.getList(0x0002).get(0).asBoolean());
|
||||
|
@ -26,100 +26,100 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
|
||||
callback("SubAddHostEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubAddHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubAddHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host")));
|
||||
callback("SubAddHostEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubAddProxyEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubAddProxyEvent(data.getRawString("proxy")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubAddProxyEvent(data.getString("proxy")));
|
||||
callback("SubAddProxyEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubAddServerEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubAddServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getRawString("host"):null, data.getRawString("server")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubAddServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getString("host"):null, data.getString("server")));
|
||||
callback("SubAddServerEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubCreateEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubCreateEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host"), data.getRawString("name"),
|
||||
data.getRawString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubCreateEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host"), data.getString("name"),
|
||||
data.getString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update")));
|
||||
callback("SubCreateEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubCreatedEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubCreatedEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host"), data.getRawString("name"),
|
||||
data.getRawString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update"), data.getBoolean("success")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubCreatedEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host"), data.getString("name"),
|
||||
data.getString("template"), data.getVersion("version"), data.getInt("port"), data.getBoolean("update"), data.getBoolean("success")));
|
||||
callback("SubCreatedEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubSendCommandEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubSendCommandEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), data.getRawString("command")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubSendCommandEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), data.getString("command")));
|
||||
callback("SubSendCommandEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubEditServerEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubEditServerEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), new ContainedPair<String, Object>(data.getRawString("edit"), data.get("value"))));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubEditServerEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), new ContainedPair<String, Object>(data.getString("edit"), data.get("value"))));
|
||||
callback("SubEditServerEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStartEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubStartEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubStartEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server")));
|
||||
callback("SubStartEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStartedEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubStartedEvent(data.getRawString("server")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubStartedEvent(data.getString("server")));
|
||||
callback("SubStartedEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStopEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubStopEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), data.getBoolean("force")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubStopEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), data.getBoolean("force")));
|
||||
callback("SubStopEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubStoppedEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubStoppedEvent(data.getRawString("server")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubStoppedEvent(data.getString("server")));
|
||||
callback("SubStoppedEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubRemoveServerEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubRemoveServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getRawString("host"):null, data.getRawString("server")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubRemoveServerEvent((data.contains("player"))?data.getUUID("player"):null, (data.contains("host"))?data.getString("host"):null, data.getString("server")));
|
||||
callback("SubRemoveServerEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubRemoveProxyEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubAddProxyEvent(data.getRawString("proxy")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubAddProxyEvent(data.getString("proxy")));
|
||||
callback("SubRemoveProxyEvent", this);
|
||||
}
|
||||
});
|
||||
callback("SubRemoveHostEvent", new Consumer<ObjectMap<String>>() {
|
||||
@Override
|
||||
public void accept(ObjectMap<String> data) {
|
||||
ExProxy.getInstance().getEventManager().fire(new SubRemoveHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host")));
|
||||
ExProxy.getInstance().getEventManager().fire(new SubRemoveHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host")));
|
||||
callback("SubRemoveHostEvent", this);
|
||||
}
|
||||
});
|
||||
|
@ -50,20 +50,20 @@ public class PacketLinkProxy implements InitialPacket, PacketObjectIn<Integer>,
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||
if (data.getInt(0x0001) == 0) {
|
||||
try {
|
||||
if (data.contains(0x0000)) Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getRawString(0x0000));
|
||||
if (data.contains(0x0000)) Util.reflect(SubAPI.class.getDeclaredField("name"), plugin.api, data.getString(0x0000));
|
||||
setReady(client.getConnection());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
Logger.get("SubData").info("Could not link name with proxy" + ((data.contains(0x0002))?": "+data.getRawString(0x0002):'.'));
|
||||
Logger.get("SubData").info("Could not link name with proxy" + ((data.contains(0x0002))?": "+data.getString(0x0002):'.'));
|
||||
try {
|
||||
if (data.getInt(0x0001) == 2) {
|
||||
if (!plugin.config.get().getMap("Settings").getMap("SubData").contains("Name")) {
|
||||
plugin.config.get().getMap("Settings").getMap("SubData").set("Name", "");
|
||||
plugin.config.save();
|
||||
}
|
||||
if (plugin.config.get().getMap("Settings").getMap("SubData").getRawString("Name").length() <= 0)
|
||||
if (plugin.config.get().getMap("Settings").getMap("SubData").getString("Name").length() <= 0)
|
||||
Logger.get("SubData").info("Use the proxy \"Name\" option to override auto-linking");
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
@ -166,10 +166,10 @@ public class SubProtocol extends SubDataProtocol {
|
||||
try {
|
||||
ProxyConfig config = ExProxy.getInstance().getConfiguration(); // TODO maybe?
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Forced-Hosts", true)) Util.reflect(ListenerInfo.class.getDeclaredField("forcedHosts"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getMap("forced-hosts").get());
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Motd", false)) Util.reflect(ListenerInfo.class.getDeclaredField("motd"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getRawString("motd"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Motd", false)) Util.reflect(ListenerInfo.class.getDeclaredField("motd"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getString("motd"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Player-Limit", false)) Util.reflect(ListenerInfo.class.getDeclaredField("maxPlayers"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getInt("player-limit"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Server-Priorities", true)) Util.reflect(ListenerInfo.class.getDeclaredField("serverPriority"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getRawStringList("priorities"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Disabled-Commands", false)) Util.reflect(Configuration.class.getDeclaredField("disabledCommands"), plugin.getConfig(), platform.getMap("bungee").getRawStringList("disabled-cmds"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Server-Priorities", true)) Util.reflect(ListenerInfo.class.getDeclaredField("serverPriority"), listeners.get(i), platform.getMap("bungee").getMapList("listeners").get(i).getStringList("priorities"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Disabled-Commands", false)) Util.reflect(Configuration.class.getDeclaredField("disabledCommands"), plugin.getConfig(), platform.getMap("bungee").getStringList("disabled-cmds"));
|
||||
if (plugin.config.get().getMap("Sync", new ObjectMap<>()).getBoolean("Player-Limit", false)) Util.reflect(Configuration.class.getDeclaredField("playerLimit"), plugin.getConfig(), platform.getMap("bungee").getInt("player-limit"));
|
||||
} catch (Exception e) {
|
||||
net.ME1312.SubServers.Velocity.Library.Compatibility.Logger.get("SubServers").info("Problem converting synced BungeeCord configuration options");
|
||||
|
Loading…
Reference in New Issue
Block a user