Minor reference changes

This commit is contained in:
ME1312 2021-12-31 17:55:56 -05:00
parent 80d2557631
commit c5573801c4
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
18 changed files with 56 additions and 59 deletions

View File

@ -95,7 +95,7 @@ public class ExternalSubCreator extends SubCreator {
public boolean create(UUID player, String name, ServerTemplate template, Version version, Integer port, Consumer<SubServer> callback) { public boolean create(UUID player, String name, ServerTemplate template, Version version, Integer port, Consumer<SubServer> callback) {
Util.nullpo(name, template); Util.nullpo(name, template);
if (host.isAvailable() && host.isEnabled() && template.isEnabled() && !SubAPI.getInstance().getSubServers().keySet().contains(name.toLowerCase()) && !SubCreator.isReserved(name) && (version != null || !template.requiresVersion())) { if (host.isAvailable() && host.isEnabled() && template.isEnabled() && !SubAPI.getInstance().getSubServers().keySet().contains(name.toLowerCase()) && !SubCreator.isReserved(name) && (version != null || !template.requiresVersion())) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
if (port == null) { if (port == null) {
Container<Integer> i = new Container<Integer>(ports.lowerEndpoint() - 1); Container<Integer> i = new Container<Integer>(ports.lowerEndpoint() - 1);
@ -141,7 +141,7 @@ public class ExternalSubCreator extends SubCreator {
Util.nullpo(server); Util.nullpo(server);
final ServerTemplate ft = (template == null)?server.getTemplate():template; final ServerTemplate ft = (template == null)?server.getTemplate():template;
if (host.isAvailable() && host.isEnabled() && host == server.getHost() && server.isAvailable() && !server.isRunning() && ft != null && ft.isEnabled() && ft.canUpdate() && (version != null || !ft.requiresVersion())) { if (host.isAvailable() && host.isEnabled() && host == server.getHost() && server.isAvailable() && !server.isRunning() && ft != null && ft.isEnabled() && ft.canUpdate() && (version != null || !ft.requiresVersion())) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
String name = server.getName(); String name = server.getName();
String prefix = name + File.separator + "Updater"; String prefix = name + File.separator + "Updater";

View File

@ -390,7 +390,7 @@ public class InternalSubCreator extends SubCreator {
public boolean create(UUID player, String name, ServerTemplate template, Version version, Integer port, Consumer<SubServer> callback) { public boolean create(UUID player, String name, ServerTemplate template, Version version, Integer port, Consumer<SubServer> callback) {
Util.nullpo(name, template); Util.nullpo(name, template);
if (host.isAvailable() && host.isEnabled() && template.isEnabled() && !SubAPI.getInstance().getSubServers().keySet().contains(name.toLowerCase()) && !SubCreator.isReserved(name) && (version != null || !template.requiresVersion())) { if (host.isAvailable() && host.isEnabled() && template.isEnabled() && !SubAPI.getInstance().getSubServers().keySet().contains(name.toLowerCase()) && !SubCreator.isReserved(name) && (version != null || !template.requiresVersion())) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
if (port == null) { if (port == null) {
Value<Integer> i = new Container<Integer>(ports.lowerEndpoint() - 1); Value<Integer> i = new Container<Integer>(ports.lowerEndpoint() - 1);
@ -432,7 +432,7 @@ public class InternalSubCreator extends SubCreator {
Util.nullpo(server); Util.nullpo(server);
final ServerTemplate ft = (template == null)?server.getTemplate():template; final ServerTemplate ft = (template == null)?server.getTemplate():template;
if (host.isAvailable() && host.isEnabled() && host == server.getHost() && server.isAvailable() && !server.isRunning() && ft != null && ft.isEnabled() && ft.canUpdate() && (version != null || !ft.requiresVersion())) { if (host.isAvailable() && host.isEnabled() && host == server.getHost() && server.isAvailable() && !server.isRunning() && ft != null && ft.isEnabled() && ft.canUpdate() && (version != null || !ft.requiresVersion())) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
((InternalSubServer) server).updating(true); ((InternalSubServer) server).updating(true);
CreatorTask task = new CreatorTask(player, server, ft, version, x -> { CreatorTask task = new CreatorTask(player, server, ft, version, x -> {

View File

@ -159,7 +159,7 @@ public class RemotePlayer implements net.ME1312.SubServers.Bungee.Library.Compat
new RPSI() { new RPSI() {
@Override @Override
protected void sendMessage(UUID[] players, String[] messages, IntConsumer response) { protected void sendMessage(UUID[] players, String[] messages, IntConsumer response) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
PacketMessagePlayer.run(Arrays.asList(players), new ContainedPair<>(messages, null), null, i -> { PacketMessagePlayer.run(Arrays.asList(players), new ContainedPair<>(messages, null), null, i -> {
try { try {
response.accept(i); response.accept(i);
@ -173,7 +173,7 @@ public class RemotePlayer implements net.ME1312.SubServers.Bungee.Library.Compat
@Override @Override
protected void sendMessage(UUID[] players, BaseComponent[][] messages, IntConsumer response) { protected void sendMessage(UUID[] players, BaseComponent[][] messages, IntConsumer response) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
PacketMessagePlayer.run(Arrays.asList(players), new ContainedPair<>(null, messages), null, i -> { PacketMessagePlayer.run(Arrays.asList(players), new ContainedPair<>(null, messages), null, i -> {
try { try {
response.accept(i); response.accept(i);
@ -187,7 +187,7 @@ public class RemotePlayer implements net.ME1312.SubServers.Bungee.Library.Compat
@Override @Override
protected void transfer(UUID[] players, String server, IntConsumer response) { protected void transfer(UUID[] players, String server, IntConsumer response) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
PacketTransferPlayer.run(Arrays.asList(players), server, i -> { PacketTransferPlayer.run(Arrays.asList(players), server, i -> {
try { try {
response.accept(i); response.accept(i);
@ -201,7 +201,7 @@ public class RemotePlayer implements net.ME1312.SubServers.Bungee.Library.Compat
@Override @Override
protected void disconnect(UUID[] players, String reason, IntConsumer response) { protected void disconnect(UUID[] players, String reason, IntConsumer response) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
PacketDisconnectPlayer.run(Arrays.asList(players), reason, i -> { PacketDisconnectPlayer.run(Arrays.asList(players), reason, i -> {
try { try {
response.accept(i); response.accept(i);

View File

@ -75,7 +75,7 @@ public class PacketMessagePlayer implements PacketObjectIn<Integer>, PacketObjec
ProxyServer.getInstance().broadcast(c); ProxyServer.getInstance().broadcast(c);
} }
for (Proxy proxy : SubAPI.getInstance().getProxies().values()) { for (Proxy proxy : SubAPI.getInstance().getProxies().values()) {
if (proxy.getPlayers().size() > 0) requests.put(proxy, null); if (proxy.getPlayers().size() > 0 && proxy.getSubData()[0] != null) requests.put(proxy, null);
} }
} else { } else {
for (UUID id : ids) { for (UUID id : ids) {

View File

@ -890,7 +890,7 @@ public final class SubCommand extends Command {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void selectServers(CommandSender sender, String[] rargs, int index, boolean mode, String[][] permissions, Consumer<ServerSelection> callback) { private void selectServers(CommandSender sender, String[] rargs, int index, boolean mode, String[][] permissions, Consumer<ServerSelection> callback) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
LinkedList<String> msgs = new LinkedList<String>(); LinkedList<String> msgs = new LinkedList<String>();
LinkedList<String> args = new LinkedList<String>(); LinkedList<String> args = new LinkedList<String>();
LinkedList<String> selection = new LinkedList<String>(); LinkedList<String> selection = new LinkedList<String>();

View File

@ -138,7 +138,7 @@ public abstract class ClientAPI {
*/ */
public void addServer(UUID player, String name, InetAddress ip, int port, String motd, boolean hidden, boolean restricted, IntConsumer response) { public void addServer(UUID player, String name, InetAddress ip, int port, String motd, boolean hidden, boolean restricted, IntConsumer response) {
Util.nullpo(response); Util.nullpo(response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
((SubDataClient) getSubDataNetwork()[0]).sendPacket(new PacketAddServer(player, name, ip, port, motd, hidden, restricted, data -> { ((SubDataClient) getSubDataNetwork()[0]).sendPacket(new PacketAddServer(player, name, ip, port, motd, hidden, restricted, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));
@ -265,7 +265,7 @@ public abstract class ClientAPI {
private void removeServer(UUID player, String name, boolean force, IntConsumer response) { private void removeServer(UUID player, String name, boolean force, IntConsumer response) {
Util.nullpo(response); Util.nullpo(response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
((SubDataClient) getSubDataNetwork()[0]).sendPacket(new PacketRemoveServer(player, name, force, data -> { ((SubDataClient) getSubDataNetwork()[0]).sendPacket(new PacketRemoveServer(player, name, force, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));

View File

@ -176,7 +176,7 @@ public class Host {
*/ */
public void getRemotePlayers(Consumer<Collection<RemotePlayer>> callback) { public void getRemotePlayers(Consumer<Collection<RemotePlayer>> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
Runnable run = () -> { Runnable run = () -> {
try { try {
callback.accept(players); callback.accept(players);
@ -363,7 +363,7 @@ public class Host {
*/ */
public void addSubServer(UUID player, String name, boolean enabled, int port, String motd, boolean log, String directory, String executable, String stopcmd, boolean hidden, boolean restricted, IntConsumer response) { public void addSubServer(UUID player, String name, boolean enabled, int port, String motd, boolean log, String directory, String executable, String stopcmd, boolean hidden, boolean restricted, IntConsumer response) {
Util.nullpo(response); Util.nullpo(response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client().sendPacket(new PacketAddServer(player, name, enabled, getName(), port, motd, log, directory, executable, stopcmd, hidden, restricted, data -> { client().sendPacket(new PacketAddServer(player, name, enabled, getName(), port, motd, log, directory, executable, stopcmd, hidden, restricted, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));
@ -500,7 +500,7 @@ public class Host {
private void removeSubServer(UUID player, String name, boolean force, IntConsumer response) { private void removeSubServer(UUID player, String name, boolean force, IntConsumer response) {
Util.nullpo(response); Util.nullpo(response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client().sendPacket(new PacketRemoveServer(player, name, force, data -> { client().sendPacket(new PacketRemoveServer(player, name, force, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));
@ -686,7 +686,7 @@ public class Host {
private void deleteSubServer(UUID player, String name, boolean recycle, boolean force, IntConsumer response) { private void deleteSubServer(UUID player, String name, boolean recycle, boolean force, IntConsumer response) {
Util.nullpo(response); Util.nullpo(response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client().sendPacket(new PacketDeleteServer(player, name, recycle, force, data -> { client().sendPacket(new PacketDeleteServer(player, name, recycle, force, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));

View File

@ -131,7 +131,7 @@ public class Proxy {
*/ */
public void getPlayers(Consumer<Collection<RemotePlayer>> callback) { public void getPlayers(Consumer<Collection<RemotePlayer>> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
Runnable run = () -> { Runnable run = () -> {
try { try {
callback.accept(players); callback.accept(players);

View File

@ -116,7 +116,7 @@ public class RemotePlayer {
*/ */
public void getProxy(Consumer<Proxy> callback) { public void getProxy(Consumer<Proxy> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
Runnable run = () -> { Runnable run = () -> {
try { try {
callback.accept(proxy); callback.accept(proxy);
@ -153,7 +153,7 @@ public class RemotePlayer {
*/ */
public void getServer(Consumer<Server> callback) { public void getServer(Consumer<Server> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
Runnable run = () -> { Runnable run = () -> {
try { try {
callback.accept(server); callback.accept(server);
@ -543,7 +543,7 @@ public class RemotePlayer {
* @param response Success Status * @param response Success Status
*/ */
protected void sendMessage(SubDataClient client, UUID[] players, String[] messages, IntConsumer response) { protected void sendMessage(SubDataClient client, UUID[] players, String[] messages, IntConsumer response) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client.sendPacket(new PacketMessagePlayer(players, messages, null, data -> { client.sendPacket(new PacketMessagePlayer(players, messages, null, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));
@ -564,7 +564,7 @@ public class RemotePlayer {
* @param response Success Status * @param response Success Status
*/ */
protected void sendRawMessage(SubDataClient client, UUID[] players, String[] messages, IntConsumer response) { protected void sendRawMessage(SubDataClient client, UUID[] players, String[] messages, IntConsumer response) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client.sendPacket(new PacketMessagePlayer(players, null, messages, data -> { client.sendPacket(new PacketMessagePlayer(players, null, messages, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));
@ -585,7 +585,7 @@ public class RemotePlayer {
* @param response Success Status * @param response Success Status
*/ */
protected void transfer(SubDataClient client, UUID[] players, String server, IntConsumer response) { protected void transfer(SubDataClient client, UUID[] players, String server, IntConsumer response) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client.sendPacket(new PacketTransferPlayer(players, server, data -> { client.sendPacket(new PacketTransferPlayer(players, server, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));
@ -606,7 +606,7 @@ public class RemotePlayer {
* @param response Success status * @param response Success status
*/ */
protected void disconnect(SubDataClient client, UUID[] players, String reason, IntConsumer response) { protected void disconnect(SubDataClient client, UUID[] players, String reason, IntConsumer response) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client.sendPacket(new PacketDisconnectPlayer(players, reason, data -> { client.sendPacket(new PacketDisconnectPlayer(players, reason, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));

View File

@ -131,7 +131,7 @@ public class Server {
*/ */
public void command(UUID player, UUID target, String command, IntConsumer response) { public void command(UUID player, UUID target, String command, IntConsumer response) {
Util.nullpo(command, response); Util.nullpo(command, response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client().sendPacket(new PacketCommandServer(player, target, getName(), command, data -> { client().sendPacket(new PacketCommandServer(player, target, getName(), command, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));
@ -214,7 +214,7 @@ public class Server {
*/ */
public void getRemotePlayers(Consumer<Collection<RemotePlayer>> callback) { public void getRemotePlayers(Consumer<Collection<RemotePlayer>> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
Runnable run = () -> { Runnable run = () -> {
try { try {
callback.accept(players); callback.accept(players);

View File

@ -29,7 +29,7 @@ public final class SimplifiedData {
*/ */
public static void requestHosts(DataClient client, Consumer<Map<String, Host>> callback) { public static void requestHosts(DataClient client, Consumer<Map<String, Host>> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadHostInfo(null, data -> { client(client).sendPacket(new PacketDownloadHostInfo(null, data -> {
TreeMap<String, Host> hosts = new TreeMap<String, Host>(); TreeMap<String, Host> hosts = new TreeMap<String, Host>();
for (String host : data.getKeys()) { for (String host : data.getKeys()) {
@ -55,7 +55,7 @@ public final class SimplifiedData {
*/ */
public static void requestHost(DataClient client, String name, Consumer<Host> callback) { public static void requestHost(DataClient client, String name, Consumer<Host> callback) {
Util.nullpo(name, callback); Util.nullpo(name, callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadHostInfo(Collections.singletonList(name), data -> { client(client).sendPacket(new PacketDownloadHostInfo(Collections.singletonList(name), data -> {
Host host = null; Host host = null;
if (data.getKeys().size() > 0) { if (data.getKeys().size() > 0) {
@ -80,7 +80,7 @@ public final class SimplifiedData {
*/ */
public static void requestGroups(DataClient client, Consumer<Map<String, List<Server>>> callback) { public static void requestGroups(DataClient client, Consumer<Map<String, List<Server>>> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadGroupInfo(null, data -> { client(client).sendPacket(new PacketDownloadGroupInfo(null, data -> {
TreeMap<String, List<Server>> groups = new TreeMap<String, List<Server>>(); TreeMap<String, List<Server>> groups = new TreeMap<String, List<Server>>();
for (String group : data.getKeys()) { for (String group : data.getKeys()) {
@ -131,7 +131,7 @@ public final class SimplifiedData {
*/ */
public static void requestGroup(DataClient client, String name, Consumer<Pair<String, List<Server>>> callback) { public static void requestGroup(DataClient client, String name, Consumer<Pair<String, List<Server>>> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadGroupInfo((name == null)?Collections.emptyList():Collections.singletonList(name), data -> { client(client).sendPacket(new PacketDownloadGroupInfo((name == null)?Collections.emptyList():Collections.singletonList(name), data -> {
Pair<String, List<Server>> group = null; Pair<String, List<Server>> group = null;
if (data.getKeys().size() > 0) { if (data.getKeys().size() > 0) {
@ -165,7 +165,7 @@ public final class SimplifiedData {
*/ */
public static void requestServers(DataClient client, Consumer<Map<String, Server>> callback) { public static void requestServers(DataClient client, Consumer<Map<String, Server>> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadServerInfo(null, data -> { client(client).sendPacket(new PacketDownloadServerInfo(null, data -> {
TreeMap<String, Server> servers = new TreeMap<String, Server>(); TreeMap<String, Server> servers = new TreeMap<String, Server>();
for (String server : data.getKeys()) { for (String server : data.getKeys()) {
@ -195,7 +195,7 @@ public final class SimplifiedData {
*/ */
public static void requestServer(DataClient client, String name, Consumer<Server> callback) { public static void requestServer(DataClient client, String name, Consumer<Server> callback) {
Util.nullpo(name, callback); Util.nullpo(name, callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadServerInfo(Collections.singletonList(name), data -> { client(client).sendPacket(new PacketDownloadServerInfo(Collections.singletonList(name), data -> {
Server server = null; Server server = null;
if (data.getKeys().size() > 0) { if (data.getKeys().size() > 0) {
@ -254,7 +254,7 @@ public final class SimplifiedData {
*/ */
public static void requestProxies(DataClient client, Consumer<Map<String, Proxy>> callback) { public static void requestProxies(DataClient client, Consumer<Map<String, Proxy>> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadProxyInfo(null, data -> { client(client).sendPacket(new PacketDownloadProxyInfo(null, data -> {
TreeMap<String, Proxy> proxies = new TreeMap<String, Proxy>(); TreeMap<String, Proxy> proxies = new TreeMap<String, Proxy>();
for (String proxy : data.getKeys()) { for (String proxy : data.getKeys()) {
@ -280,7 +280,7 @@ public final class SimplifiedData {
*/ */
public static void requestProxy(DataClient client, String name, Consumer<Proxy> callback) { public static void requestProxy(DataClient client, String name, Consumer<Proxy> callback) {
Util.nullpo(name, callback); Util.nullpo(name, callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadProxyInfo(Collections.singletonList(name), data -> { client(client).sendPacket(new PacketDownloadProxyInfo(Collections.singletonList(name), data -> {
Proxy proxy = null; Proxy proxy = null;
if (data.getKeys().size() > 0) { if (data.getKeys().size() > 0) {
@ -305,7 +305,7 @@ public final class SimplifiedData {
*/ */
public static void requestMasterProxy(DataClient client, Consumer<Proxy> callback) { public static void requestMasterProxy(DataClient client, Consumer<Proxy> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadProxyInfo(Collections.emptyList(), data -> { client(client).sendPacket(new PacketDownloadProxyInfo(Collections.emptyList(), data -> {
Proxy proxy = null; Proxy proxy = null;
if (data.getKeys().size() > 0) { if (data.getKeys().size() > 0) {
@ -330,7 +330,7 @@ public final class SimplifiedData {
*/ */
public static void requestRemotePlayers(DataClient client, Consumer<Map<UUID, RemotePlayer>> callback) { public static void requestRemotePlayers(DataClient client, Consumer<Map<UUID, RemotePlayer>> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadPlayerInfo((List<UUID>) null, data -> { client(client).sendPacket(new PacketDownloadPlayerInfo((List<UUID>) null, data -> {
TreeMap<UUID, RemotePlayer> players = new TreeMap<UUID, RemotePlayer>(); TreeMap<UUID, RemotePlayer> players = new TreeMap<UUID, RemotePlayer>();
for (String player : data.getKeys()) { for (String player : data.getKeys()) {
@ -356,7 +356,7 @@ public final class SimplifiedData {
*/ */
public static void requestRemotePlayer(DataClient client, String name, Consumer<RemotePlayer> callback) { public static void requestRemotePlayer(DataClient client, String name, Consumer<RemotePlayer> callback) {
Util.nullpo(name, callback); Util.nullpo(name, callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadPlayerInfo(Collections.singletonList(name), data -> { client(client).sendPacket(new PacketDownloadPlayerInfo(Collections.singletonList(name), data -> {
RemotePlayer player = null; RemotePlayer player = null;
if (data.getKeys().size() > 0) { if (data.getKeys().size() > 0) {
@ -382,7 +382,7 @@ public final class SimplifiedData {
*/ */
public static void requestRemotePlayer(DataClient client, UUID id, Consumer<RemotePlayer> callback) { public static void requestRemotePlayer(DataClient client, UUID id, Consumer<RemotePlayer> callback) {
Util.nullpo(id, callback); Util.nullpo(id, callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client(client).sendPacket(new PacketDownloadPlayerInfo(Collections.singletonList(id), data -> { client(client).sendPacket(new PacketDownloadPlayerInfo(Collections.singletonList(id), data -> {
RemotePlayer player = null; RemotePlayer player = null;
if (data.getKeys().size() > 0) { if (data.getKeys().size() > 0) {

View File

@ -135,7 +135,7 @@ public class SubCreator {
*/ */
public void create(UUID player, String name, ServerTemplate template, Version version, Integer port, IntConsumer response) { public void create(UUID player, String name, ServerTemplate template, Version version, Integer port, IntConsumer response) {
Util.nullpo(response); Util.nullpo(response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
((SubDataClient) ClientAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketCreateServer(player, name, host.getName(), template.getName(), version, port, data -> { ((SubDataClient) ClientAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketCreateServer(player, name, host.getName(), template.getName(), version, port, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));
@ -196,7 +196,7 @@ public class SubCreator {
*/ */
public void update(UUID player, SubServer server, ServerTemplate template, Version version, IntConsumer response) { public void update(UUID player, SubServer server, ServerTemplate template, Version version, IntConsumer response) {
Util.nullpo(response); Util.nullpo(response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
((SubDataClient) ClientAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketUpdateServer(player, server.getName(), template.getName(), version, data -> { ((SubDataClient) ClientAPI.getInstance().getSubDataNetwork()[0]).sendPacket(new PacketUpdateServer(player, server.getName(), template.getName(), version, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));

View File

@ -91,7 +91,7 @@ public class SubServer extends Server {
*/ */
public void start(UUID player, IntConsumer response) { public void start(UUID player, IntConsumer response) {
Util.nullpo(response); Util.nullpo(response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client().sendPacket(new PacketStartServer(player, getName(), data -> { client().sendPacket(new PacketStartServer(player, getName(), data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));
@ -136,7 +136,7 @@ public class SubServer extends Server {
*/ */
public void stop(UUID player, IntConsumer response) { public void stop(UUID player, IntConsumer response) {
Util.nullpo(response); Util.nullpo(response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client().sendPacket(new PacketStopServer(player, getName(), false, data -> { client().sendPacket(new PacketStopServer(player, getName(), false, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));
@ -181,7 +181,7 @@ public class SubServer extends Server {
*/ */
public void terminate(UUID player, IntConsumer response) { public void terminate(UUID player, IntConsumer response) {
Util.nullpo(response); Util.nullpo(response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client().sendPacket(new PacketStopServer(player, getName(), true, data -> { client().sendPacket(new PacketStopServer(player, getName(), true, data -> {
try { try {
response.accept(data.getInt(0x0001)); response.accept(data.getInt(0x0001));
@ -300,7 +300,7 @@ public class SubServer extends Server {
private void edit(UUID player, ObjectMap<String> edit, boolean perma, IntConsumer response) { private void edit(UUID player, ObjectMap<String> edit, boolean perma, IntConsumer response) {
Util.nullpo(response); Util.nullpo(response);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
client().sendPacket(new PacketEditServer(player, getName(), edit, perma, data -> { client().sendPacket(new PacketEditServer(player, getName(), edit, perma, data -> {
try { try {
if (data.getInt(0x0001) != 0) { if (data.getInt(0x0001) != 0) {
@ -351,7 +351,7 @@ public class SubServer extends Server {
*/ */
public void getHost(Consumer<Host> callback) { public void getHost(Consumer<Host> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
Runnable run = () -> { Runnable run = () -> {
try { try {
callback.accept(host); callback.accept(host);
@ -627,7 +627,7 @@ public class SubServer extends Server {
*/ */
public void getIncompatibilities(Consumer<List<SubServer>> callback) { public void getIncompatibilities(Consumer<List<SubServer>> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
Runnable run = () -> { Runnable run = () -> {
try { try {
callback.accept(incompatibilities); callback.accept(incompatibilities);
@ -671,7 +671,7 @@ public class SubServer extends Server {
*/ */
public void getCurrentIncompatibilities(Consumer<List<SubServer>> callback) { public void getCurrentIncompatibilities(Consumer<List<SubServer>> callback) {
Util.nullpo(callback); Util.nullpo(callback);
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
Runnable run = () -> { Runnable run = () -> {
try { try {
callback.accept(currentIncompatibilities); callback.accept(currentIncompatibilities);

View File

@ -7,9 +7,7 @@ import org.spongepowered.api.text.format.TextStyle;
import org.spongepowered.api.text.format.TextStyles; import org.spongepowered.api.text.format.TextStyles;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
@ -127,16 +125,15 @@ public enum ChatColor {
} }
if (str.contains(Character.toString(character))) { if (str.contains(Character.toString(character))) {
LinkedList<String> pieces = new LinkedList<String>(Arrays.asList(str.split(Pattern.quote(Character.toString(character))))); String[] pieces = str.split(Pattern.quote(Character.toString(character)));
Collections.reverse(pieces); String piece;
Text result = null; Text result = null;
int i = pieces.size();
for (String piece : pieces) {
i--;
Text.Builder current; Text.Builder current;
for (int i = pieces.length; i > 0;) {
piece = pieces[--i];
if (i > 0 && piece.length() > 0) { if (i > 0 && piece.length() > 0) {
if (map.keySet().contains(piece.toCharArray()[0])) { if (map.containsKey(piece.toCharArray()[0])) {
current = Text.builder(piece.substring(1)); current = Text.builder(piece.substring(1));
ChatColor color = map.get(piece.toCharArray()[0]); ChatColor color = map.get(piece.toCharArray()[0]);
current.style(color.getStyles()); current.style(color.getStyles());

View File

@ -1346,7 +1346,7 @@ public final class SubCommand implements CommandExecutor {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void selectServers(CommandSource sender, String[] selection, boolean mode, String[][] permissions, Consumer<ServerSelection> callback) { private void selectServers(CommandSource sender, String[] selection, boolean mode, String[][] permissions, Consumer<ServerSelection> callback) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
LinkedList<Text> msgs = new LinkedList<Text>(); LinkedList<Text> msgs = new LinkedList<Text>();
LinkedList<Server> select = new LinkedList<Server>(); LinkedList<Server> select = new LinkedList<Server>();

View File

@ -982,7 +982,7 @@ public class SubCommand {
} }
private void selectServers(CommandSender sender, String[] rargs, int index, boolean mode, Consumer<ServerSelection> callback) { private void selectServers(CommandSender sender, String[] rargs, int index, boolean mode, Consumer<ServerSelection> callback) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
LinkedList<String> msgs = new LinkedList<String>(); LinkedList<String> msgs = new LinkedList<String>();
LinkedList<String> args = new LinkedList<String>(); LinkedList<String> args = new LinkedList<String>();
LinkedList<String> selection = new LinkedList<String>(); LinkedList<String> selection = new LinkedList<String>();

View File

@ -735,7 +735,7 @@ public final class SubCommand extends Command implements TabExecutor {
} }
private void selectServers(CommandSender sender, String[] rargs, int index, boolean mode, Consumer<ServerSelection> callback) { private void selectServers(CommandSender sender, String[] rargs, int index, boolean mode, Consumer<ServerSelection> callback) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
LinkedList<String> msgs = new LinkedList<String>(); LinkedList<String> msgs = new LinkedList<String>();
LinkedList<String> args = new LinkedList<String>(); LinkedList<String> args = new LinkedList<String>();
LinkedList<String> selection = new LinkedList<String>(); LinkedList<String> selection = new LinkedList<String>();

View File

@ -740,7 +740,7 @@ public final class SubCommand implements SimpleCommand {
} }
private void selectServers(CommandSource sender, String[] rargs, int index, boolean mode, Consumer<ServerSelection> callback) { private void selectServers(CommandSource sender, String[] rargs, int index, boolean mode, Consumer<ServerSelection> callback) {
StackTraceElement[] origin = new Exception().getStackTrace(); StackTraceElement[] origin = new Throwable().getStackTrace();
LinkedList<Component> msgs = new LinkedList<Component>(); LinkedList<Component> msgs = new LinkedList<Component>();
LinkedList<String> args = new LinkedList<String>(); LinkedList<String> args = new LinkedList<String>();
LinkedList<String> selection = new LinkedList<String>(); LinkedList<String> selection = new LinkedList<String>();