Minor API efficiency improvements
This commit is contained in:
parent
eba5e6a7d1
commit
ff82fd5151
|
@ -28,13 +28,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.Galaxi</groupId>
|
<groupId>net.ME1312.Galaxi</groupId>
|
||||||
<artifactId>GalaxiUtil</artifactId>
|
<artifactId>GalaxiUtil</artifactId>
|
||||||
<version>21w15a</version>
|
<version>21w15b</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.Galaxi</groupId>
|
<groupId>net.ME1312.Galaxi</groupId>
|
||||||
<artifactId>GalaxiEngine</artifactId>
|
<artifactId>GalaxiEngine</artifactId>
|
||||||
<version>21w15a</version>
|
<version>21w15b</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -28,14 +28,14 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.Galaxi</groupId>
|
<groupId>net.ME1312.Galaxi</groupId>
|
||||||
<artifactId>GalaxiUtil</artifactId>
|
<artifactId>GalaxiUtil</artifactId>
|
||||||
<version>21w15a</version>
|
<version>21w15b</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.Galaxi</groupId>
|
<groupId>net.ME1312.Galaxi</groupId>
|
||||||
<artifactId>GalaxiEngine</artifactId>
|
<artifactId>GalaxiEngine</artifactId>
|
||||||
<version>21w15a</version>
|
<version>21w15b</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public class Executable {
|
public class Executable {
|
||||||
private Executable() {}
|
private Executable() {}
|
||||||
|
private static final boolean USE_SESSION_TRACKING;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format a command to be executed
|
* Format a command to be executed
|
||||||
|
@ -30,7 +31,7 @@ public class Executable {
|
||||||
exec = '"' + gitbash + ((gitbash.endsWith(File.separator))?"":File.separator) + "bin" + File.separatorChar + "sh.exe\" -lc \"" +
|
exec = '"' + gitbash + ((gitbash.endsWith(File.separator))?"":File.separator) + "bin" + File.separatorChar + "sh.exe\" -lc \"" +
|
||||||
exec.replace("\\", "/\\").replace("\"", "\\\"").replace("^", "^^").replace("%", "^%").replace("&", "^&").replace("<", "^<").replace(">", "^>").replace("|", "^|") + '"';
|
exec.replace("\\", "/\\").replace("\"", "\\\"").replace("^", "^^").replace("%", "^%").replace("&", "^&").replace("<", "^<").replace(">", "^>").replace("|", "^|") + '"';
|
||||||
cmd = new String[]{"cmd.exe", "/q", "/c", '"'+exec+'"'};
|
cmd = new String[]{"cmd.exe", "/q", "/c", '"'+exec+'"'};
|
||||||
} else if (Platform.getSystem() == Platform.LINUX) {
|
} else if (USE_SESSION_TRACKING) {
|
||||||
cmd = new String[]{"setsid", "-w", "sh", "-lc", exec};
|
cmd = new String[]{"setsid", "-w", "sh", "-lc", exec};
|
||||||
} else {
|
} else {
|
||||||
cmd = new String[]{"sh", "-lc", exec};
|
cmd = new String[]{"sh", "-lc", exec};
|
||||||
|
@ -38,6 +39,14 @@ public class Executable {
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
USE_SESSION_TRACKING = Platform.getSystem() != Platform.WINDOWS && Util.getDespiteException(() -> {
|
||||||
|
Process test = Runtime.getRuntime().exec(new String[]{"setsid", "-w", "bash", "-c", "exit 0"});
|
||||||
|
test.waitFor(); // The purpose of this block is to test for the 'setsid' command
|
||||||
|
return test.exitValue() == 0;
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the PID of a currently running process
|
* Get the PID of a currently running process
|
||||||
*
|
*
|
||||||
|
@ -88,7 +97,7 @@ public class Executable {
|
||||||
if (pid != null) try {
|
if (pid != null) try {
|
||||||
if (Platform.getSystem() == Platform.WINDOWS) {
|
if (Platform.getSystem() == Platform.WINDOWS) {
|
||||||
Runtime.getRuntime().exec(new String[]{"taskkill.exe", "/T", "/F", "/PID", pid.toString()}).waitFor();
|
Runtime.getRuntime().exec(new String[]{"taskkill.exe", "/T", "/F", "/PID", pid.toString()}).waitFor();
|
||||||
} else if (Platform.getSystem() == Platform.LINUX) {
|
} else if (USE_SESSION_TRACKING) {
|
||||||
Runtime.getRuntime().exec(new String[]{"bash", "-c", "kill -9 $(ps -o pid= --sid $(ps -o sid= --pid " + pid + "))"}).waitFor();
|
Runtime.getRuntime().exec(new String[]{"bash", "-c", "kill -9 $(ps -o pid= --sid $(ps -o sid= --pid " + pid + "))"}).waitFor();
|
||||||
}
|
}
|
||||||
} catch (IOException | InterruptedException e) {}
|
} catch (IOException | InterruptedException e) {}
|
||||||
|
|
|
@ -70,11 +70,11 @@ public class ExternalHost extends Host implements ClientHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataClient[] getSubData() {
|
public DataClient[] getSubData() {
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.keySet());
|
Integer[] keys = subdata.keySet().toArray(new Integer[0]);
|
||||||
LinkedList<SubDataClient> channels = new LinkedList<SubDataClient>();
|
DataClient[] channels = new DataClient[keys.length];
|
||||||
Collections.sort(keys);
|
Arrays.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.get(channel));
|
for (int i = 0; i < keys.length; ++i) channels[i] = subdata.get(keys[i]);
|
||||||
return channels.toArray(new DataClient[0]);
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubData(DataClient client, int channel) {
|
public void setSubData(DataClient client, int channel) {
|
||||||
|
|
|
@ -44,11 +44,11 @@ public class Proxy implements ClientHandler, ExtraDataHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataClient[] getSubData() {
|
public DataClient[] getSubData() {
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.keySet());
|
Integer[] keys = subdata.keySet().toArray(new Integer[0]);
|
||||||
LinkedList<SubDataClient> channels = new LinkedList<SubDataClient>();
|
DataClient[] channels = new DataClient[keys.length];
|
||||||
Collections.sort(keys);
|
Arrays.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.get(channel));
|
for (int i = 0; i < keys.length; ++i) channels[i] = subdata.get(keys[i]);
|
||||||
return channels.toArray(new DataClient[0]);
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|
|
@ -82,11 +82,11 @@ public class ServerImpl extends BungeeServerInfo implements Server {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataClient[] getSubData() {
|
public DataClient[] getSubData() {
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.keySet());
|
Integer[] keys = subdata.keySet().toArray(new Integer[0]);
|
||||||
LinkedList<SubDataClient> channels = new LinkedList<SubDataClient>();
|
DataClient[] channels = new DataClient[keys.length];
|
||||||
Collections.sort(keys);
|
Arrays.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(subdata.get(channel));
|
for (int i = 0; i < keys.length; ++i) channels[i] = subdata.get(keys[i]);
|
||||||
return channels.toArray(new DataClient[0]);
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubData(DataClient client, int channel) {
|
public void setSubData(DataClient client, int channel) {
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.Galaxi</groupId>
|
<groupId>net.ME1312.Galaxi</groupId>
|
||||||
<artifactId>GalaxiUtil</artifactId>
|
<artifactId>GalaxiUtil</artifactId>
|
||||||
<version>21w15a</version>
|
<version>21w15b</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -71,11 +71,11 @@ public final class SubAPI extends ClientAPI {
|
||||||
* @return SubData Network Connections
|
* @return SubData Network Connections
|
||||||
*/
|
*/
|
||||||
public DataClient[] getSubDataNetwork() {
|
public DataClient[] getSubDataNetwork() {
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(plugin.subdata.keySet());
|
Integer[] keys = plugin.subdata.keySet().toArray(new Integer[0]);
|
||||||
LinkedList<SubDataClient> channels = new LinkedList<SubDataClient>();
|
DataClient[] channels = new DataClient[keys.length];
|
||||||
Collections.sort(keys);
|
Arrays.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(plugin.subdata.get(channel));
|
for (int i = 0; i < keys.length; ++i) channels[i] = plugin.subdata.get(keys[i]);
|
||||||
return channels.toArray(new DataClient[0]);
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -87,7 +87,6 @@ public final class SubPlugin extends JavaPlugin {
|
||||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||||
reload(false);
|
reload(false);
|
||||||
|
|
||||||
subdata.put(0, null);
|
|
||||||
subprotocol = SubProtocol.get();
|
subprotocol = SubProtocol.get();
|
||||||
subprotocol.registerCipher("DHE", DHE.get(128));
|
subprotocol.registerCipher("DHE", DHE.get(128));
|
||||||
subprotocol.registerCipher("DHE-128", DHE.get(128));
|
subprotocol.registerCipher("DHE-128", DHE.get(128));
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.Galaxi</groupId>
|
<groupId>net.ME1312.Galaxi</groupId>
|
||||||
<artifactId>GalaxiUtil</artifactId>
|
<artifactId>GalaxiUtil</artifactId>
|
||||||
<version>21w15a</version>
|
<version>21w15b</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -88,11 +88,11 @@ public class Host {
|
||||||
public DataSender[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
if (raw.contains("subdata")) {
|
if (raw.contains("subdata")) {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
Integer[] keys = subdata.getKeys().toArray(new Integer[0]);
|
||||||
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
DataSender[] channels = new DataSender[keys.length];
|
||||||
Collections.sort(keys);
|
Arrays.sort(keys);
|
||||||
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) ClientAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
for (int i = 0; i < keys.length; ++i) channels[i] = (subdata.isNull(keys[i]))? null : new ForwardedDataSender((SubDataClient) ClientAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(keys[i]));
|
||||||
return channels.toArray(new SubDataSender[0]);
|
return channels;
|
||||||
} else {
|
} else {
|
||||||
return new SubDataSender[0];
|
return new SubDataSender[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,11 +78,11 @@ public class Proxy {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public DataSender[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
Integer[] keys = subdata.getKeys().toArray(new Integer[0]);
|
||||||
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
DataSender[] channels = new DataSender[keys.length];
|
||||||
Collections.sort(keys);
|
Arrays.sort(keys);
|
||||||
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) ClientAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
for (int i = 0; i < keys.length; ++i) channels[i] = (subdata.isNull(keys[i]))? null : new ForwardedDataSender((SubDataClient) ClientAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(keys[i]));
|
||||||
return channels.toArray(new SubDataSender[0]);
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -78,11 +78,11 @@ public class Server {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public DataSender[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
ObjectMap<Integer> subdata = new ObjectMap<Integer>((Map<Integer, ?>) raw.getObject("subdata"));
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.getKeys());
|
Integer[] keys = subdata.getKeys().toArray(new Integer[0]);
|
||||||
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
DataSender[] channels = new DataSender[keys.length];
|
||||||
Collections.sort(keys);
|
Arrays.sort(keys);
|
||||||
for (Integer channel : keys) channels.add((subdata.isNull(channel))?null:new ForwardedDataSender((SubDataClient) ClientAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(channel)));
|
for (int i = 0; i < keys.length; ++i) channels[i] = (subdata.isNull(keys[i]))? null : new ForwardedDataSender((SubDataClient) ClientAPI.getInstance().getSubDataNetwork()[0], subdata.getUUID(keys[i]));
|
||||||
return channels.toArray(new SubDataSender[0]);
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.Galaxi</groupId>
|
<groupId>net.ME1312.Galaxi</groupId>
|
||||||
<artifactId>GalaxiUtil</artifactId>
|
<artifactId>GalaxiUtil</artifactId>
|
||||||
<version>21w15a</version>
|
<version>21w15b</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -73,11 +73,11 @@ public final class SubAPI extends ClientAPI {
|
||||||
* @return SubData Network Connections
|
* @return SubData Network Connections
|
||||||
*/
|
*/
|
||||||
public DataClient[] getSubDataNetwork() {
|
public DataClient[] getSubDataNetwork() {
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(plugin.subdata.keySet());
|
Integer[] keys = plugin.subdata.keySet().toArray(new Integer[0]);
|
||||||
LinkedList<SubDataClient> channels = new LinkedList<SubDataClient>();
|
DataClient[] channels = new DataClient[keys.length];
|
||||||
Collections.sort(keys);
|
Arrays.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(plugin.subdata.get(channel));
|
for (int i = 0; i < keys.length; ++i) channels[i] = plugin.subdata.get(keys[i]);
|
||||||
return channels.toArray(new DataClient[0]);
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -106,7 +106,6 @@ public final class SubPlugin {
|
||||||
running = true;
|
running = true;
|
||||||
reload(false);
|
reload(false);
|
||||||
|
|
||||||
subdata.put(0, null);
|
|
||||||
subprotocol = SubProtocol.get();
|
subprotocol = SubProtocol.get();
|
||||||
subprotocol.registerCipher("DHE", DHE.get(128));
|
subprotocol.registerCipher("DHE", DHE.get(128));
|
||||||
subprotocol.registerCipher("DHE-128", DHE.get(128));
|
subprotocol.registerCipher("DHE-128", DHE.get(128));
|
||||||
|
|
|
@ -31,14 +31,14 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.Galaxi</groupId>
|
<groupId>net.ME1312.Galaxi</groupId>
|
||||||
<artifactId>GalaxiEngine</artifactId>
|
<artifactId>GalaxiEngine</artifactId>
|
||||||
<version>21w15a</version>
|
<version>21w15b</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.Galaxi</groupId>
|
<groupId>net.ME1312.Galaxi</groupId>
|
||||||
<artifactId>GalaxiUI</artifactId>
|
<artifactId>GalaxiUI</artifactId>
|
||||||
<version>21w15a</version>
|
<version>21w15b</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public class Executable {
|
public class Executable {
|
||||||
private Executable() {}
|
private Executable() {}
|
||||||
|
private static final boolean USE_SESSION_TRACKING;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format a command to be executed
|
* Format a command to be executed
|
||||||
|
@ -30,7 +31,7 @@ public class Executable {
|
||||||
exec = '"' + gitbash + ((gitbash.endsWith(File.separator))?"":File.separator) + "bin" + File.separatorChar + "sh.exe\" -lc \"" +
|
exec = '"' + gitbash + ((gitbash.endsWith(File.separator))?"":File.separator) + "bin" + File.separatorChar + "sh.exe\" -lc \"" +
|
||||||
exec.replace("\\", "/\\").replace("\"", "\\\"").replace("^", "^^").replace("%", "^%").replace("&", "^&").replace("<", "^<").replace(">", "^>").replace("|", "^|") + '"';
|
exec.replace("\\", "/\\").replace("\"", "\\\"").replace("^", "^^").replace("%", "^%").replace("&", "^&").replace("<", "^<").replace(">", "^>").replace("|", "^|") + '"';
|
||||||
cmd = new String[]{"cmd.exe", "/q", "/c", '"'+exec+'"'};
|
cmd = new String[]{"cmd.exe", "/q", "/c", '"'+exec+'"'};
|
||||||
} else if (Platform.getSystem() == Platform.LINUX) {
|
} else if (USE_SESSION_TRACKING) {
|
||||||
cmd = new String[]{"setsid", "-w", "sh", "-lc", exec};
|
cmd = new String[]{"setsid", "-w", "sh", "-lc", exec};
|
||||||
} else {
|
} else {
|
||||||
cmd = new String[]{"sh", "-lc", exec};
|
cmd = new String[]{"sh", "-lc", exec};
|
||||||
|
@ -38,6 +39,14 @@ public class Executable {
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
USE_SESSION_TRACKING = Platform.getSystem() != Platform.WINDOWS && Util.getDespiteException(() -> {
|
||||||
|
Process test = Runtime.getRuntime().exec(new String[]{"setsid", "-w", "bash", "-c", "exit 0"});
|
||||||
|
test.waitFor(); // The purpose of this block is to test for the 'setsid' command
|
||||||
|
return test.exitValue() == 0;
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the PID of a currently running process
|
* Get the PID of a currently running process
|
||||||
*
|
*
|
||||||
|
@ -88,7 +97,7 @@ public class Executable {
|
||||||
if (pid != null) try {
|
if (pid != null) try {
|
||||||
if (Platform.getSystem() == Platform.WINDOWS) {
|
if (Platform.getSystem() == Platform.WINDOWS) {
|
||||||
Runtime.getRuntime().exec(new String[]{"taskkill.exe", "/T", "/F", "/PID", pid.toString()}).waitFor();
|
Runtime.getRuntime().exec(new String[]{"taskkill.exe", "/T", "/F", "/PID", pid.toString()}).waitFor();
|
||||||
} else if (Platform.getSystem() == Platform.LINUX) {
|
} else if (USE_SESSION_TRACKING) {
|
||||||
Runtime.getRuntime().exec(new String[]{"bash", "-c", "kill -9 $(ps -o pid= --sid $(ps -o sid= --pid " + pid + "))"}).waitFor();
|
Runtime.getRuntime().exec(new String[]{"bash", "-c", "kill -9 $(ps -o pid= --sid $(ps -o sid= --pid " + pid + "))"}).waitFor();
|
||||||
}
|
}
|
||||||
} catch (IOException | InterruptedException e) {}
|
} catch (IOException | InterruptedException e) {}
|
||||||
|
|
|
@ -57,11 +57,11 @@ public final class SubAPI extends ClientAPI {
|
||||||
* @return SubData Network Connections
|
* @return SubData Network Connections
|
||||||
*/
|
*/
|
||||||
public DataClient[] getSubDataNetwork() {
|
public DataClient[] getSubDataNetwork() {
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(host.subdata.keySet());
|
Integer[] keys = host.subdata.keySet().toArray(new Integer[0]);
|
||||||
LinkedList<SubDataClient> channels = new LinkedList<SubDataClient>();
|
DataClient[] channels = new DataClient[keys.length];
|
||||||
Collections.sort(keys);
|
Arrays.sort(keys);
|
||||||
for (Integer channel : keys) channels.add(host.subdata.get(channel));
|
for (int i = 0; i < keys.length; ++i) channels[i] = host.subdata.get(keys[i]);
|
||||||
return channels.toArray(new DataClient[0]);
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,14 +28,14 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.Galaxi</groupId>
|
<groupId>net.ME1312.Galaxi</groupId>
|
||||||
<artifactId>GalaxiUtil</artifactId>
|
<artifactId>GalaxiUtil</artifactId>
|
||||||
<version>21w15a</version>
|
<version>21w15b</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ME1312.Galaxi</groupId>
|
<groupId>net.ME1312.Galaxi</groupId>
|
||||||
<artifactId>GalaxiEngine</artifactId>
|
<artifactId>GalaxiEngine</artifactId>
|
||||||
<version>21w15a</version>
|
<version>21w15b</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -67,11 +67,11 @@ public class ServerImpl extends BungeeServerInfo {
|
||||||
* @return SubData Client Channel ID Array
|
* @return SubData Client Channel ID Array
|
||||||
*/
|
*/
|
||||||
public DataSender[] getSubData() {
|
public DataSender[] getSubData() {
|
||||||
LinkedList<Integer> keys = new LinkedList<Integer>(subdata.keySet());
|
Integer[] keys = subdata.keySet().toArray(new Integer[0]);
|
||||||
LinkedList<SubDataSender> channels = new LinkedList<SubDataSender>();
|
DataSender[] channels = new DataSender[keys.length];
|
||||||
Collections.sort(keys);
|
Arrays.sort(keys);
|
||||||
for (Integer channel : keys) channels.add((subdata.getOrDefault(channel, null) == null)?null:new ForwardedDataSender((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0], subdata.get(channel)));
|
for (int i = 0; i < keys.length; ++i) channels[i] = (subdata.getOrDefault(keys[i], null) == null)? null : new ForwardedDataSender((SubDataClient) SubAPI.getInstance().getSubDataNetwork()[0], subdata.get(keys[i]));
|
||||||
return channels.toArray(new SubDataSender[0]);
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue