#35 Add command line variables to SubServers

Also, a fix for #34
This commit is contained in:
ME1312 2019-01-17 10:39:15 -05:00
parent b88facf7f3
commit 75a872252f
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
25 changed files with 84 additions and 57 deletions

View File

@ -135,6 +135,9 @@
<outputDirectory>${basedir}/../Javadoc/SubServers.Bungee</outputDirectory>
<reportOutputDirectory>${basedir}/../Javadoc/SubServers.Bungee</reportOutputDirectory>
<additionalOptions>-Xdoclint:none</additionalOptions>
<links>
<link>https://ci.md-5.net/job/BungeeCord/ws/api/target/apidocs/</link>
</links>
</configuration>
</execution>
</executions>

View File

@ -22,7 +22,7 @@ public class Executable {
public static String[] parse(String gitbash, String exec) {
String[] cmd;
if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
if (gitbash != null && (exec.startsWith("bash ") || exec.startsWith("sh ")))
if (gitbash != null && (exec.toLowerCase().startsWith("bash ") || exec.toLowerCase().startsWith("sh ")))
exec = '"' + gitbash + ((gitbash.endsWith(File.separator))?"":File.separator) + "bin" + File.separatorChar + "sh.exe\" -lc \"" +
exec.replace("\\", "/\\").replace("\"", "\\\"").replace("^", "^^").replace("%", "^%").replace("&", "^&").replace("<", "^<").replace(">", "^>").replace("|", "^|") + '"';
cmd = new String[]{"cmd.exe", "/q", "/c", '"'+exec+'"'};

View File

@ -102,7 +102,7 @@ public class ExternalSubLogger extends SubLogger {
}
// Filter Message
boolean allow = log.get() && (!SubAPI.getInstance().getInternals().canSudo || SubAPI.getInstance().getInternals().sudo == null || SubAPI.getInstance().getInternals().sudo == getHandler());
boolean allow = (SubAPI.getInstance().getInternals().sudo == getHandler() && SubAPI.getInstance().getInternals().canSudo) || (log.get() && (SubAPI.getInstance().getInternals().sudo == null || !SubAPI.getInstance().getInternals().canSudo));
List<SubLogFilter> filters = new ArrayList<SubLogFilter>();
filters.addAll(this.filters);
for (SubLogFilter filter : filters)

View File

@ -127,7 +127,10 @@ public class InternalSubCreator extends SubCreator {
if (template.getBuildOptions().getBoolean("Use-Cache", true)) {
cache = new UniversalFile(host.plugin.dir, "SubServers:Cache:Templates:" + template.getName());
cache.mkdirs();
var.put("cache", cache.toString().replace(File.separatorChar, '/'));
String c = cache.toString();
if (System.getProperty("os.name").toLowerCase().startsWith("windows") &&
(template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("bash ") || template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("sh "))) c = c.replace(File.separatorChar, '/');
var.put("cache", c);
} else {
cache = null;
}

View File

@ -121,7 +121,7 @@ public class InternalSubLogger extends SubLogger {
}
// Filter Message
boolean allow = log.get() && (!SubAPI.getInstance().getInternals().canSudo || SubAPI.getInstance().getInternals().sudo == null || SubAPI.getInstance().getInternals().sudo == getHandler());
boolean allow = (SubAPI.getInstance().getInternals().sudo == getHandler() && SubAPI.getInstance().getInternals().canSudo) || (log.get() && (SubAPI.getInstance().getInternals().sudo == null || !SubAPI.getInstance().getInternals().canSudo));
List<SubLogFilter> filters = new ArrayList<SubLogFilter>();
filters.addAll(this.filters);
for (SubLogFilter filter : filters)

View File

@ -119,7 +119,10 @@ public class InternalSubServer extends SubServerContainer {
private void run() {
allowrestart = true;
try {
process = Runtime.getRuntime().exec(Executable.parse(host.getCreator().getBashDirectory(), executable), null, directory);
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(host.getCreator().getBashDirectory(), executable)).directory(directory);
pb.environment().put("name", getName());
pb.environment().put("port", Integer.toString(getAddress().getPort()));
process = pb.start();
System.out.println("SubServers > Now starting " + getName());
logger.process = process;
logger.start();

View File

@ -70,7 +70,7 @@ public class PacketCommandServer implements PacketIn, PacketOut {
boolean sent = false;
for (Server server : servers.values()) {
if (server instanceof SubServer && ((SubServer) server).isRunning()) {
if (((SubServer) server).command((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("command"))) {
if (((SubServer) server).command((data.contains("player"))?data.getUUID("player"):null, data.getRawString("command"))) {
sent = true;
}
}
@ -81,7 +81,7 @@ public class PacketCommandServer implements PacketIn, PacketOut {
client.sendPacket(new PacketCommandServer(1, "Couldn't send command", (data.contains("id")) ? data.getRawString("id") : null));
}
} else {
if (((SubServer) servers.get(data.getRawString("server").toLowerCase())).command((data.contains("player")) ? UUID.fromString(data.getRawString("player")) : null, data.getRawString("command"))) {
if (((SubServer) servers.get(data.getRawString("server").toLowerCase())).command((data.contains("player"))?data.getUUID("player"):null, data.getRawString("command"))) {
client.sendPacket(new PacketCommandServer(0, "Sending Command", (data.contains("id")) ? data.getRawString("id") : null));
} else {
client.sendPacket(new PacketCommandServer(1, "Couldn't send command", (data.contains("id")) ? data.getRawString("id") : null));

View File

@ -73,7 +73,7 @@ public class PacketCreateServer implements PacketIn, PacketOut {
} else if (data.getSection("creator").contains("port") && (data.getSection("creator").getInt("port") <= 0 || data.getSection("creator").getInt("port") > 65535)) {
client.sendPacket(new PacketCreateServer(11, "Invalid Port Number", (data.contains("id")) ? data.getRawString("id") : null));
} else {
if (plugin.hosts.get(data.getSection("creator").getString("host").toLowerCase()).getCreator().create((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getSection("creator").getString("name"), plugin.hosts.get(data.getSection("creator").getString("host").toLowerCase()).getCreator().getTemplate(data.getSection("creator").getString("template")), new Version(data.getSection("creator").getString("version")), (data.getSection("creator").contains("port"))?data.getSection("creator").getInt("port"):null)) {
if (plugin.hosts.get(data.getSection("creator").getString("host").toLowerCase()).getCreator().create((data.contains("player"))?data.getUUID("player"):null, data.getSection("creator").getString("name"), plugin.hosts.get(data.getSection("creator").getString("host").toLowerCase()).getCreator().getTemplate(data.getSection("creator").getString("template")), new Version(data.getSection("creator").getString("version")), (data.getSection("creator").contains("port"))?data.getSection("creator").getInt("port"):null)) {
if (data.contains("wait") && data.getBoolean("wait")) {
new Thread(() -> {
try {

View File

@ -25,8 +25,8 @@ public class PacketInExLogMessage implements PacketIn {
@Override
public void execute(Client client, YAMLSection data) {
try {
if (data.contains("h") && data.contains("m") && data.getRawString("m").length() != 0 && loggers.keySet().contains(UUID.fromString(data.getRawString("h")))) {
Util.reflect(ExternalSubLogger.class.getDeclaredMethod("log", String.class), loggers.get(UUID.fromString(data.getRawString("h"))), data.getRawString("m"));
if (data.contains("h") && data.contains("m") && data.getRawString("m").length() != 0 && loggers.keySet().contains(data.getUUID("h"))) {
Util.reflect(ExternalSubLogger.class.getDeclaredMethod("log", String.class), loggers.get(data.getUUID("h")), data.getRawString("m"));
}
} catch (Exception e) {
e.printStackTrace();

View File

@ -79,7 +79,7 @@ public class PacketStartServer implements PacketIn, PacketOut {
}
client.sendPacket(new PacketStartServer(9, "Cannot start SubServer while these servers are running: " + list, (data.contains("id")) ? data.getRawString("id") : null));
} else {
if (((SubServer) servers.get(data.getRawString("server").toLowerCase())).start((data.contains("player"))?UUID.fromString(data.getRawString("player")):null)) {
if (((SubServer) servers.get(data.getRawString("server").toLowerCase())).start((data.contains("player"))?data.getUUID("player"):null)) {
client.sendPacket(new PacketStartServer(0, "Starting SubServer", (data.contains("id"))?data.getRawString("id"):null));
} else {
client.sendPacket(new PacketStartServer(1, "Couldn't start SubServer", (data.contains("id"))?data.getRawString("id"):null));

View File

@ -70,7 +70,7 @@ public class PacketStopServer implements PacketIn, PacketOut {
if (data.contains("force") && data.getBoolean("force")) {
for (Server server : servers.values()) {
if (server instanceof SubServer && ((SubServer) server).isRunning()) {
if (((SubServer) server).terminate((data.contains("player"))?UUID.fromString(data.getRawString("player")):null)) {
if (((SubServer) server).terminate((data.contains("player"))?data.getUUID("player"):null)) {
sent = true;
}
}
@ -83,7 +83,7 @@ public class PacketStopServer implements PacketIn, PacketOut {
} else {
for (Server server : servers.values()) {
if (server instanceof SubServer && ((SubServer) server).isRunning()) {
if (((SubServer) server).stop((data.contains("player"))?UUID.fromString(data.getRawString("player")):null)) {
if (((SubServer) server).stop((data.contains("player"))?data.getUUID("player"):null)) {
sent = true;
}
}
@ -96,13 +96,13 @@ public class PacketStopServer implements PacketIn, PacketOut {
}
} else {
if (data.contains("force") && data.getBoolean("force")) {
if (((SubServer) servers.get(data.getRawString("server").toLowerCase())).terminate((data.contains("player"))?UUID.fromString(data.getRawString("player")):null)) {
if (((SubServer) servers.get(data.getRawString("server").toLowerCase())).terminate((data.contains("player"))?data.getUUID("player"):null)) {
client.sendPacket(new PacketStopServer(0, "Terminating SubServer", (data.contains("id"))?data.getRawString("id"):null));
} else {
client.sendPacket(new PacketStopServer(1, "Couldn't terminate SubServer", (data.contains("id"))?data.getRawString("id"):null));
}
} else {
if (((SubServer) servers.get(data.getRawString("server").toLowerCase())).stop((data.contains("player"))?UUID.fromString(data.getRawString("player")):null)) {
if (((SubServer) servers.get(data.getRawString("server").toLowerCase())).stop((data.contains("player"))?data.getUUID("player"):null)) {
client.sendPacket(new PacketStopServer(0, "Stopping SubServer", (data.contains("id"))?data.getRawString("id"):null));
} else {
client.sendPacket(new PacketStopServer(1, "Couldn't stop SubServer", (data.contains("id"))?data.getRawString("id"):null));

View File

@ -134,6 +134,9 @@
<outputDirectory>${basedir}/../../Javadoc/SubServers.Client.Bukkit</outputDirectory>
<reportOutputDirectory>${basedir}/../../Javadoc/SubServers.Client.Bukkit</reportOutputDirectory>
<additionalOptions>-Xdoclint:none</additionalOptions>
<links>
<link>https://hub.spigotmc.org/javadocs/spigot/</link>
</links>
</configuration>
</execution>
</executions>

View File

@ -28,7 +28,7 @@ public class PacketInRunEvent implements PacketIn {
@Override
public void run(YAMLSection data) {
if (plugin.isEnabled()) {
Bukkit.getPluginManager().callEvent(new SubAddHostEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("host")));
Bukkit.getPluginManager().callEvent(new SubAddHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host")));
callback("SubAddHostEvent", this);
}
}
@ -46,7 +46,7 @@ public class PacketInRunEvent implements PacketIn {
@Override
public void run(YAMLSection data) {
if (plugin.isEnabled()) {
Bukkit.getPluginManager().callEvent(new SubAddServerEvent((data.contains("player")) ? UUID.fromString(data.getString("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.getRawString("host"):null, data.getString("server")));
callback("SubAddServerEvent", this);
}
}
@ -55,7 +55,7 @@ public class PacketInRunEvent implements PacketIn {
@Override
public void run(YAMLSection data) {
if (plugin.isEnabled()) {
Bukkit.getPluginManager().callEvent(new SubCreateEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("host"), data.getString("name"),
Bukkit.getPluginManager().callEvent(new SubCreateEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host"), data.getString("name"),
data.getString("template"), new Version(data.getString("version")), data.getInt("port")));
callback("SubCreateEvent", this);
}
@ -65,7 +65,7 @@ public class PacketInRunEvent implements PacketIn {
@Override
public void run(YAMLSection data) {
if (plugin.isEnabled()) {
Bukkit.getPluginManager().callEvent(new SubSendCommandEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("server"), data.getString("command")));
Bukkit.getPluginManager().callEvent(new SubSendCommandEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), data.getString("command")));
callback("SubSendCommandEvent", this);
}
}
@ -74,7 +74,7 @@ public class PacketInRunEvent implements PacketIn {
@Override
public void run(YAMLSection data) {
if (plugin.isEnabled()) {
Bukkit.getPluginManager().callEvent(new SubEditServerEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("server"), new NamedContainer<String, Object>(data.getString("edit"), data.get("value")), data.getBoolean("perm")));
Bukkit.getPluginManager().callEvent(new SubEditServerEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), new NamedContainer<String, Object>(data.getString("edit"), data.get("value")), data.getBoolean("perm")));
callback("SubEditServerEvent", this);
}
}
@ -83,7 +83,7 @@ public class PacketInRunEvent implements PacketIn {
@Override
public void run(YAMLSection data) {
if (plugin.isEnabled()) {
Bukkit.getPluginManager().callEvent(new SubStartEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("server")));
Bukkit.getPluginManager().callEvent(new SubStartEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server")));
callback("SubStartEvent", this);
}
}
@ -92,7 +92,7 @@ public class PacketInRunEvent implements PacketIn {
@Override
public void run(YAMLSection data) {
if (plugin.isEnabled()) {
Bukkit.getPluginManager().callEvent(new SubStopEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("server"), data.getBoolean("force")));
Bukkit.getPluginManager().callEvent(new SubStopEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), data.getBoolean("force")));
callback("SubStopEvent", this);
}
}
@ -110,7 +110,7 @@ public class PacketInRunEvent implements PacketIn {
@Override
public void run(YAMLSection data) {
if (plugin.isEnabled()) {
Bukkit.getPluginManager().callEvent(new SubRemoveServerEvent((data.contains("player")) ? UUID.fromString(data.getString("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.getRawString("host"):null, data.getString("server")));
callback("SubRemoveServerEvent", this);
}
}
@ -128,7 +128,7 @@ public class PacketInRunEvent implements PacketIn {
@Override
public void run(YAMLSection data) {
if (plugin.isEnabled()) {
Bukkit.getPluginManager().callEvent(new SubRemoveHostEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("host")));
Bukkit.getPluginManager().callEvent(new SubRemoveHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host")));
callback("SubRemoveHostEvent", this);
}
}

View File

@ -113,6 +113,9 @@
<outputDirectory>${basedir}/../../Javadoc/SubServers.Client.Sponge</outputDirectory>
<reportOutputDirectory>${basedir}/../../Javadoc/SubServers.Client.Sponge</reportOutputDirectory>
<additionalOptions>-Xdoclint:none</additionalOptions>
<links>
<link>https://jd.spongepowered.org/</link>
</links>
</configuration>
</execution>
</executions>

View File

@ -27,7 +27,7 @@ public class PacketInRunEvent implements PacketIn {
callback("SubAddHostEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
Sponge.getEventManager().post(new SubAddHostEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("host")));
Sponge.getEventManager().post(new SubAddHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host")));
callback("SubAddHostEvent", this);
}
});
@ -41,14 +41,14 @@ public class PacketInRunEvent implements PacketIn {
callback("SubAddServerEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
Sponge.getEventManager().post(new SubAddServerEvent((data.contains("player")) ? UUID.fromString(data.getString("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.getRawString("host"):null, data.getString("server")));
callback("SubAddServerEvent", this);
}
});
callback("SubCreateEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
Sponge.getEventManager().post(new SubCreateEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("host"), data.getString("name"),
Sponge.getEventManager().post(new SubCreateEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host"), data.getString("name"),
data.getString("template"), new Version(data.getString("version")), data.getInt("port")));
callback("SubCreateEvent", this);
}
@ -56,28 +56,28 @@ public class PacketInRunEvent implements PacketIn {
callback("SubSendCommandEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
Sponge.getEventManager().post(new SubSendCommandEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("server"), data.getString("command")));
Sponge.getEventManager().post(new SubSendCommandEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), data.getString("command")));
callback("SubSendCommandEvent", this);
}
});
callback("SubEditServerEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
Sponge.getEventManager().post(new SubEditServerEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("server"), new NamedContainer<String, Object>(data.getString("edit"), data.get("value")), data.getBoolean("perm")));
Sponge.getEventManager().post(new SubEditServerEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), new NamedContainer<String, Object>(data.getString("edit"), data.get("value")), data.getBoolean("perm")));
callback("SubEditServerEvent", this);
}
});
callback("SubStartEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
Sponge.getEventManager().post(new SubStartEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("server")));
Sponge.getEventManager().post(new SubStartEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server")));
callback("SubStartEvent", this);
}
});
callback("SubStopEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
Sponge.getEventManager().post(new SubStopEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("server"), data.getBoolean("force")));
Sponge.getEventManager().post(new SubStopEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("server"), data.getBoolean("force")));
callback("SubStopEvent", this);
}
});
@ -91,7 +91,7 @@ public class PacketInRunEvent implements PacketIn {
callback("SubRemoveServerEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
Sponge.getEventManager().post(new SubRemoveServerEvent((data.contains("player")) ? UUID.fromString(data.getString("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.getRawString("host"):null, data.getString("server")));
callback("SubRemoveServerEvent", this);
}
});
@ -105,7 +105,7 @@ public class PacketInRunEvent implements PacketIn {
callback("SubRemoveHostEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
Sponge.getEventManager().post(new SubRemoveHostEvent((data.contains("player")) ? UUID.fromString(data.getString("player")) : null, data.getString("host")));
Sponge.getEventManager().post(new SubRemoveHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getString("host")));
callback("SubRemoveHostEvent", this);
}
});

View File

@ -120,6 +120,9 @@
<outputDirectory>${basedir}/../Javadoc/SubServers.Host</outputDirectory>
<reportOutputDirectory>${basedir}/../Javadoc/SubServers.Host</reportOutputDirectory>
<additionalOptions>-Xdoclint:none</additionalOptions>
<links>
<link>https://src.me1312.net/jenkins/job/GalaxiEngine/javadoc/GalaxiEngine/</link>
</links>
</configuration>
</execution>
</executions>

View File

@ -22,7 +22,7 @@ public class Executable {
public static String[] parse(String gitbash, String exec) {
String[] cmd;
if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
if (gitbash != null && (exec.startsWith("bash ") || exec.startsWith("sh ")))
if (gitbash != null && (exec.toLowerCase().startsWith("bash ") || exec.toLowerCase().startsWith("sh ")))
exec = '"' + gitbash + ((gitbash.endsWith(File.separator))?"":File.separator) + "bin" + File.separatorChar + "sh.exe\" -lc \"" +
exec.replace("\\", "/\\").replace("\"", "\\\"").replace("^", "^^").replace("%", "^%").replace("&", "^&").replace("<", "^<").replace(">", "^>").replace("|", "^|") + '"';
cmd = new String[]{"cmd.exe", "/q", "/c", '"'+exec+'"'};

View File

@ -275,7 +275,10 @@ public class SubCreator {
if (template.getBuildOptions().getBoolean("Use-Cache", true)) {
cache = new UniversalFile(GalaxiEngine.getInstance().getRuntimeDirectory(), "Cache:Templates:" + template.getName());
cache.mkdirs();
var.put("cache", cache.toString().replace(File.separatorChar, '/'));
String c = cache.toString();
if (System.getProperty("os.name").toLowerCase().startsWith("windows") &&
(template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("bash ") || template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("sh "))) c = c.replace(File.separatorChar, '/');
var.put("cache", c);
} else {
cache = null;
}

View File

@ -108,7 +108,10 @@ public class SubServer {
boolean falsestart = true;
allowrestart = true;
try {
process = Runtime.getRuntime().exec(Executable.parse(host.host.getRawString("Git-Bash"), executable), null, directory);
ProcessBuilder pb = new ProcessBuilder().command(Executable.parse(host.host.getRawString("Git-Bash"), executable)).directory(directory);
pb.environment().put("name", getName());
pb.environment().put("port", Integer.toString(getPort()));
process = pb.start();
falsestart = false;
host.log.info.println("Now starting " + name);
logger.process = process;

View File

@ -69,7 +69,7 @@ public class PacketExAddServer implements PacketIn, PacketOut {
host.servers.put(data.getSection("server").getRawString("name").toLowerCase(), server);
if (UPnP.isUPnPAvailable() && host.config.get().getSection("Settings").getSection("UPnP", new YAMLSection()).getBoolean("Forward-Servers", false)) UPnP.openPortTCP(server.getPort());
log.info.println("Added SubServer: " + data.getSection("server").getRawString("name"));
if (data.getSection("server").contains("running")) server.start(UUID.fromString(data.getSection("server").getRawString("running")));
if (data.getSection("server").contains("running")) server.start(data.getSection("server").getUUID("running"));
host.subdata.sendPacket(new PacketExAddServer(0, "Server Added Successfully", (data.contains("id"))?data.getRawString("id"):null));
}
} catch (Throwable e) {

View File

@ -59,7 +59,7 @@ public class PacketExCreateServer implements PacketIn, PacketOut {
public void execute(YAMLSection data) {
try {
host.creator.create(data.getSection("creator").getRawString("name"), host.templates.get(data.getSection("creator").getRawString("template").toLowerCase()), new Version(data.getSection("creator").getRawString("version")),
data.getSection("creator").getInt("port"), UUID.fromString(data.getSection("creator").getRawString("log")), (data.contains("id"))?data.getRawString("id"):null);
data.getSection("creator").getInt("port"), data.getSection("creator").getUUID("log"), (data.contains("id"))?data.getRawString("id"):null);
} catch (Throwable e) {
if (data.contains("thread")) {
host.creator.terminate(data.getRawString("thread").toLowerCase());

View File

@ -85,7 +85,7 @@ public class PacketExUpdateServer implements PacketIn, PacketOut {
server.setEnabled(data.getList("args").get(0).asBoolean());
break;
case 1:
server.start(UUID.fromString(data.getList("args").get(0).asRawString()));
server.start(data.getList("args").get(0).asUUID());
break;
case 2:
server.command(data.getList("args").get(0).asRawString());

View File

@ -27,7 +27,7 @@ public class PacketInRunEvent implements PacketIn {
callback("SubAddHostEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubAddHostEvent((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("host")));
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubAddHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host")));
callback("SubAddHostEvent", this);
}
});
@ -41,14 +41,14 @@ public class PacketInRunEvent implements PacketIn {
callback("SubAddServerEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubAddServerEvent((data.contains("player"))?UUID.fromString(data.getRawString("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.getRawString("host"):null, data.getRawString("server")));
callback("SubAddServerEvent", this);
}
});
callback("SubCreateEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubCreateEvent((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("host"), data.getRawString("name"),
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubCreateEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host"), data.getRawString("name"),
data.getRawString("template"), new Version(data.getRawString("version")), data.getInt("port")));
callback("SubCreateEvent", this);
}
@ -56,28 +56,28 @@ public class PacketInRunEvent implements PacketIn {
callback("SubSendCommandEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubSendCommandEvent((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("server"), data.getRawString("command")));
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubSendCommandEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), data.getRawString("command")));
callback("SubSendCommandEvent", this);
}
});
callback("SubEditServerEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubEditServerEvent((data.contains("player")) ? UUID.fromString(data.getRawString("player")):null, data.getRawString("server"), new NamedContainer<String, Object>(data.getRawString("edit"), data.get("value")), data.getBoolean("perm")));
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubEditServerEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), new NamedContainer<String, Object>(data.getRawString("edit"), data.get("value")), data.getBoolean("perm")));
callback("SubEditServerEvent", this);
}
});
callback("SubStartEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStartEvent((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("server")));
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStartEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server")));
callback("SubStartEvent", this);
}
});
callback("SubStopEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStopEvent((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("server"), data.getBoolean("force")));
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubStopEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), data.getBoolean("force")));
callback("SubStopEvent", this);
}
});
@ -91,7 +91,7 @@ public class PacketInRunEvent implements PacketIn {
callback("SubRemoveServerEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubRemoveServerEvent((data.contains("player"))?UUID.fromString(data.getRawString("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.getRawString("host"):null, data.getRawString("server")));
callback("SubRemoveServerEvent", this);
}
});
@ -105,7 +105,7 @@ public class PacketInRunEvent implements PacketIn {
callback("SubRemoveHostEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubRemoveHostEvent((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("host")));
GalaxiEngine.getInstance().getPluginManager().executeEvent(new SubRemoveHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host")));
callback("SubRemoveHostEvent", this);
}
});

View File

@ -129,6 +129,9 @@
<outputDirectory>${basedir}/../Javadoc/SubServers.Sync</outputDirectory>
<reportOutputDirectory>${basedir}/../Javadoc/SubServers.Sync</reportOutputDirectory>
<additionalOptions>-Xdoclint:none</additionalOptions>
<links>
<link>https://ci.md-5.net/job/BungeeCord/ws/api/target/apidocs/</link>
</links>
</configuration>
</execution>
</executions>

View File

@ -27,7 +27,7 @@ public class PacketInRunEvent implements PacketIn {
callback("SubAddHostEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
ProxyServer.getInstance().getPluginManager().callEvent(new SubAddHostEvent((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("host")));
ProxyServer.getInstance().getPluginManager().callEvent(new SubAddHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host")));
callback("SubAddHostEvent", this);
}
});
@ -41,14 +41,14 @@ public class PacketInRunEvent implements PacketIn {
callback("SubAddServerEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
ProxyServer.getInstance().getPluginManager().callEvent(new SubAddServerEvent((data.contains("player"))?UUID.fromString(data.getRawString("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.getRawString("host"):null, data.getRawString("server")));
callback("SubAddServerEvent", this);
}
});
callback("SubCreateEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
ProxyServer.getInstance().getPluginManager().callEvent(new SubCreateEvent((data.contains("player")) ? UUID.fromString(data.getRawString("player")) : null, data.getRawString("host"), data.getRawString("name"),
ProxyServer.getInstance().getPluginManager().callEvent(new SubCreateEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host"), data.getRawString("name"),
data.getRawString("template"), new Version(data.getRawString("version")), data.getInt("port")));
callback("SubCreateEvent", this);
}
@ -56,21 +56,21 @@ public class PacketInRunEvent implements PacketIn {
callback("SubSendCommandEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
ProxyServer.getInstance().getPluginManager().callEvent(new SubSendCommandEvent((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("server"), data.getRawString("command")));
ProxyServer.getInstance().getPluginManager().callEvent(new SubSendCommandEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), data.getRawString("command")));
callback("SubSendCommandEvent", this);
}
});
callback("SubEditServerEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
ProxyServer.getInstance().getPluginManager().callEvent(new SubEditServerEvent((data.contains("player")) ? UUID.fromString(data.getRawString("player")) : null, data.getRawString("server"), new NamedContainer<String, Object>(data.getRawString("edit"), data.get("value")), data.getBoolean("perm")));
ProxyServer.getInstance().getPluginManager().callEvent(new SubEditServerEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), new NamedContainer<String, Object>(data.getRawString("edit"), data.get("value")), data.getBoolean("perm")));
callback("SubEditServerEvent", this);
}
});
callback("SubStartEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
ProxyServer.getInstance().getPluginManager().callEvent(new SubStartEvent((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("server")));
ProxyServer.getInstance().getPluginManager().callEvent(new SubStartEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server")));
callback("SubStartEvent", this);
}
});
@ -91,7 +91,7 @@ public class PacketInRunEvent implements PacketIn {
callback("SubStopEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
ProxyServer.getInstance().getPluginManager().callEvent(new SubStopEvent((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("server"), data.getBoolean("force")));
ProxyServer.getInstance().getPluginManager().callEvent(new SubStopEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("server"), data.getBoolean("force")));
callback("SubStopEvent", this);
}
});
@ -105,7 +105,7 @@ public class PacketInRunEvent implements PacketIn {
callback("SubRemoveServerEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
ProxyServer.getInstance().getPluginManager().callEvent(new SubRemoveServerEvent((data.contains("player"))?UUID.fromString(data.getRawString("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.getRawString("host"):null, data.getRawString("server")));
callback("SubRemoveServerEvent", this);
}
});
@ -119,7 +119,7 @@ public class PacketInRunEvent implements PacketIn {
callback("SubRemoveHostEvent", new Callback<YAMLSection>() {
@Override
public void run(YAMLSection data) {
ProxyServer.getInstance().getPluginManager().callEvent(new SubRemoveHostEvent((data.contains("player"))?UUID.fromString(data.getRawString("player")):null, data.getRawString("host")));
ProxyServer.getInstance().getPluginManager().callEvent(new SubRemoveHostEvent((data.contains("player"))?data.getUUID("player"):null, data.getRawString("host")));
callback("SubRemoveHostEvent", this);
}
});