Some minor fixes

This commit is contained in:
ME1312 2022-02-14 12:53:55 -05:00
parent c5573801c4
commit 8a18b6f5d1
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
44 changed files with 133 additions and 151 deletions

View File

@ -79,6 +79,7 @@ public class ExternalHost extends Host implements ClientHandler {
public void setSubData(DataClient client, int channel) {
if (channel < 0) throw new IllegalArgumentException("Subchannel ID cannot be less than zero");
if (client == null && channel == 0) available = false;
if (client != null || channel == 0) {
if (!subdata.keySet().contains(channel) || (channel == 0 && (client == null || subdata.get(channel) == null))) {
subdata.put(channel, (SubDataClient) client);
@ -107,16 +108,26 @@ public class ExternalHost extends Host implements ClientHandler {
client.sendPacket(new PacketOutExReset("Prevent Desync"));
clean = true;
}
HashSet<String> served = new HashSet<String>();
LinkedList<PacketOut> queue = this.queue; this.queue = new LinkedList<PacketOut>();
PacketOut[] payload = new PacketOut[queue.size()];
for (int i = 0; i < payload.length; ++i) {
PacketOut packet = queue.get(i);
if (packet instanceof PacketExAddServer) served.add(((PacketExAddServer) packet).peek());
payload[i] = packet;
}
for (SubServer server : servers.values()) {
if (!served.contains(server.getName())) {
client.sendPacket(new PacketExAddServer((ExternalSubServer) server, (server.isRunning())?((ExternalSubLogger) server.getLogger()).getExternalAddress():null, data -> {
if (data.contains(0x0002)) ((ExternalSubServer) server).started(data.getUUID(0x0002));
}));
}
while (queue.size() != 0) {
client.sendPacket(queue.get(0));
queue.remove(0);
}
client.sendPacket(payload);
available = true;
while (this.queue.size() != 0) {
client.sendPacket(this.queue.remove(0));
}
}
@Override

View File

@ -82,7 +82,6 @@ public final class Launch {
System.out.println("*******************************************");
}
System.out.println("");
}
SubProxy plugin = new SubProxy(System.out, patched);
net.md_5.bungee.api.ProxyServer.class.getMethod("setInstance", net.md_5.bungee.api.ProxyServer.class).invoke(null, plugin);
@ -119,3 +118,4 @@ public final class Launch {
}
}
}
}

View File

@ -48,7 +48,6 @@ public class PacketCheckPermissionResponse implements PacketObjectIn<Integer>, P
@Override
public void receive(SubDataClient client, ObjectMap<Integer> data) throws Throwable {
for (Consumer<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
callbacks.remove(data.getUUID(0x0000));
for (Consumer<Boolean> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
}
}

View File

@ -49,6 +49,10 @@ public class PacketExAddServer implements PacketObjectIn<Integer>, PacketObjectO
callbacks.put(tracker, callback);
}
public String peek() {
return name;
}
@Override
public ObjectMap<Integer> send(SubDataClient client) {
ObjectMap<Integer> data = new ObjectMap<Integer>();
@ -66,7 +70,6 @@ public class PacketExAddServer implements PacketObjectIn<Integer>, PacketObjectO
@Override
public void receive(SubDataClient client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -51,7 +51,6 @@ public class PacketExControlPlayer implements PacketObjectIn<Integer>, PacketObj
@Override
public void receive(SubDataClient client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -117,7 +117,6 @@ public class PacketExCreateServer implements PacketObjectIn<Integer>, PacketObje
@Override
public void receive(SubDataClient client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -54,7 +54,6 @@ public class PacketExDeleteServer implements PacketObjectIn<Integer>, PacketObje
@Override
public void receive(SubDataClient client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -52,7 +52,6 @@ public class PacketExDisconnectPlayer implements PacketObjectIn<Integer>, Packet
@Override
public void receive(SubDataClient client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -54,7 +54,6 @@ public class PacketExMessagePlayer implements PacketObjectIn<Integer>, PacketObj
@Override
public void receive(SubDataClient client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -47,7 +47,6 @@ public class PacketExRemoveServer implements PacketObjectIn<Integer>, PacketObje
@Override
public void receive(SubDataClient client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -52,7 +52,6 @@ public class PacketExTransferPlayer implements PacketObjectIn<Integer>, PacketOb
@Override
public void receive(SubDataClient client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -155,30 +155,29 @@ public final class SubProxy extends BungeeCommon implements Listener {
Logger.get("SubServers").info("Created ./SubServers/Templates/Sponge");
} else {
long stamp = Math.round(Math.random() * 100000);
Version tv1 = new Version("2.18a+");
Version tv2 = new Version("2.18a+");
Version tv = new Version("2.18a+");
if (new File(dir, "Templates/Vanilla/template.yml").exists() && ((new YAMLConfig(new File(dir, "Templates/Vanilla/template.yml"))).get().getVersion("Version", tv2)).compareTo(tv2) != 0) {
if (new File(dir, "Templates/Vanilla/template.yml").exists() && ((new YAMLConfig(new File(dir, "Templates/Vanilla/template.yml"))).get().getVersion("Version", tv)).compareTo(tv) != 0) {
Files.move(new File(dir, "Templates/Vanilla").toPath(), new File(dir, "Templates/Vanilla." + stamp + ".x").toPath());
Directories.unzip(SubProxy.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/vanilla.zip"), new File(dir, "Templates"));
Logger.get("SubServers").info("Updated ./SubServers/Templates/Vanilla");
}
if (new File(dir, "Templates/Spigot/template.yml").exists() && ((new YAMLConfig(new File(dir, "Templates/Spigot/template.yml"))).get().getVersion("Version", tv1)).compareTo(tv1) != 0) {
if (new File(dir, "Templates/Spigot/template.yml").exists() && ((new YAMLConfig(new File(dir, "Templates/Spigot/template.yml"))).get().getVersion("Version", tv)).compareTo(tv) != 0) {
Files.move(new File(dir, "Templates/Spigot").toPath(), new File(dir, "Templates/Spigot." + stamp + ".x").toPath());
Directories.unzip(SubProxy.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/spigot.zip"), new File(dir, "Templates"));
Logger.get("SubServers").info("Updated ./SubServers/Templates/Spigot");
}
if (new File(dir, "Templates/Purpur/template.yml").exists() && ((new YAMLConfig(new File(dir, "Templates/Purpur/template.yml"))).get().getVersion("Version", tv2)).compareTo(tv2) != 0) {
if (new File(dir, "Templates/Purpur/template.yml").exists() && ((new YAMLConfig(new File(dir, "Templates/Purpur/template.yml"))).get().getVersion("Version", tv)).compareTo(tv) != 0) {
Files.move(new File(dir, "Templates/Purpur").toPath(), new File(dir, "Templates/Purpur." + stamp + ".x").toPath());
Directories.unzip(SubProxy.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/purpur.zip"), new File(dir, "Templates"));
Logger.get("SubServers").info("Updated ./SubServers/Templates/Purpur");
}
if (new File(dir, "Templates/Forge/template.yml").exists() && ((new YAMLConfig(new File(dir, "Templates/Forge/template.yml"))).get().getVersion("Version", tv2)).compareTo(tv2) != 0) {
if (new File(dir, "Templates/Forge/template.yml").exists() && ((new YAMLConfig(new File(dir, "Templates/Forge/template.yml"))).get().getVersion("Version", tv)).compareTo(tv) != 0) {
Files.move(new File(dir, "Templates/Forge").toPath(), new File(dir, "Templates/Forge." + stamp + ".x").toPath());
Directories.unzip(SubProxy.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/forge.zip"), new File(dir, "Templates"));
Logger.get("SubServers").info("Updated ./SubServers/Templates/Forge");
}
if (new File(dir, "Templates/Sponge/template.yml").exists() && ((new YAMLConfig(new File(dir, "Templates/Sponge/template.yml"))).get().getVersion("Version", tv1)).compareTo(tv1) != 0) {
if (new File(dir, "Templates/Sponge/template.yml").exists() && ((new YAMLConfig(new File(dir, "Templates/Sponge/template.yml"))).get().getVersion("Version", tv)).compareTo(tv) != 0) {
Files.move(new File(dir, "Templates/Sponge").toPath(), new File(dir, "Templates/Sponge." + stamp + ".x").toPath());
Directories.unzip(SubProxy.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/sponge.zip"), new File(dir, "Templates"));
Logger.get("SubServers").info("Updated ./SubServers/Templates/Sponge");

View File

@ -1,13 +1,14 @@
package net.ME1312.SubServers.Client.Bukkit.Graphic;
import net.ME1312.Galaxi.Library.Access;
import net.ME1312.Galaxi.Library.Container.ContainedPair;
import net.ME1312.Galaxi.Library.Container.Container;
import net.ME1312.Galaxi.Library.Try;
import net.ME1312.Galaxi.Library.Util;
import net.ME1312.Galaxi.Library.Version.Version;
import net.ME1312.SubServers.Client.Bukkit.SubPlugin;
import net.ME1312.SubServers.Client.Common.Network.API.Host;
import net.ME1312.SubServers.Client.Common.Network.API.Server;
import net.ME1312.SubServers.Client.Common.Network.API.SubServer;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -16,6 +17,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import java.lang.invoke.MethodHandle;
import java.util.*;
import java.util.PrimitiveIterator.OfInt;
import java.util.regex.Matcher;
@ -28,6 +30,7 @@ public abstract class UIRenderer {
private final boolean USE_TITLES;
private final boolean TAPI_1_11;
private final boolean TAPI_PLUGIN;
private final MethodHandle MAPI_1_13;
static final HashMap<String, PluginRenderer<Host>> hostPlugins = new HashMap<String, PluginRenderer<Host>>();
static final HashMap<String, PluginRenderer<Server>> serverPlugins = new HashMap<String, PluginRenderer<Server>>();
@ -48,6 +51,13 @@ public abstract class UIRenderer {
this.plugin = plugin;
this.player = player;
// Detect Material API
if (plugin.api.getGameVersion().compareTo(new Version("1.13")) < 0) {
MAPI_1_13 = null;
} else {
MAPI_1_13 = Try.all.get(Access.shared.type(Material.class).method("getMaterial").parameters(String.class, boolean.class).returns(Material.class)::handle);
}
// Detect Title API
if (USE_TITLES = plugin.config.get().getMap("Settings").getBoolean("Use-Title-Messages", true)) {
if (TAPI_1_11 = plugin.api.getGameVersion().compareTo(new Version("1.11")) >= 0) {
@ -296,7 +306,7 @@ public abstract class UIRenderer {
@SuppressWarnings({"deprecation", "JavaReflectionMemberAccess"})
public ItemStack parseItem(String str, ItemStack def) {
final Container<String> item = new Container<String>(str);
if (plugin.api.getGameVersion().compareTo(new Version("1.13")) < 0) {
if (MAPI_1_13 == null) {
try {
// int
Matcher matcher = Pattern.compile("(?i)^(\\d+)$").matcher(item.value);
@ -332,15 +342,16 @@ public abstract class UIRenderer {
}
// Material Name
if (plugin.api.getGameVersion().compareTo(new Version("1.13")) < 0) {
if (MAPI_1_13 == null) {
try {
return new ItemStack(Material.valueOf(item.value.toUpperCase()), 1);
} catch (IllegalArgumentException e) {}
} else try {
if (Material.class.getMethod("getMaterial", String.class, boolean.class).invoke(null, item.value.toUpperCase(), false) != null) {
return new ItemStack((Material) Material.class.getMethod("getMaterial", String.class, boolean.class).invoke(null, item.value.toUpperCase(), false), 1);
Material material = (Material) MAPI_1_13.invokeExact(item.value.toUpperCase(), false);
if (material != null) {
return new ItemStack(material, 1);
}
} catch (Exception e) {}
} catch (Throwable e) {}
return def;
}

View File

@ -49,7 +49,6 @@ public class PacketCheckPermissionResponse implements Forwardable, PacketObjectI
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
for (Consumer<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
callbacks.remove(data.getUUID(0x0000));
for (Consumer<Boolean> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
}
}

View File

@ -160,9 +160,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
if (callbacks.keySet().contains(data.getString(0x0000))) {
List<Consumer<ObjectMap<String>>> callbacks = PacketInExRunEvent.callbacks.get(data.getString(0x0000));
PacketInExRunEvent.callbacks.remove(data.getString(0x0000));
for (Consumer<ObjectMap<String>> callback : callbacks) {
for (Consumer<ObjectMap<String>> callback : PacketInExRunEvent.callbacks.remove(data.getString(0x0000))) {
callback.accept(new ObjectMap<>((Map<String, ?>) data.getObject(0x0001)));
}
}

View File

@ -112,7 +112,6 @@ public class PacketAddServer implements PacketObjectIn<Integer>, PacketObjectOut
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -59,7 +59,6 @@ public class PacketCommandServer implements PacketObjectIn<Integer>, PacketObjec
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -88,7 +88,6 @@ public class PacketCreateServer implements PacketObjectIn<Integer>, PacketObject
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -57,7 +57,6 @@ public class PacketDeleteServer implements PacketObjectIn<Integer>, PacketObject
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -51,7 +51,6 @@ public class PacketDisconnectPlayer implements PacketObjectIn<Integer>, PacketOb
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -50,13 +50,12 @@ public class PacketDownloadGroupInfo implements PacketObjectIn<Integer>, PacketO
@SuppressWarnings("unchecked")
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) {
for (Consumer<ObjectMap<String>> callback : callbacks.remove(data.getUUID(0x0000))) {
ObjectMap<String> map = new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001));
ObjectMap<String> ungrouped = (data.contains(0x0002))?new ObjectMap<String>((Map<String, ?>) data.getObject(0x0002)):null;
if (ungrouped != null) map.set("", ungrouped);
callback.accept(map);
}
callbacks.remove(data.getUUID(0x0000));
}
}

View File

@ -50,7 +50,6 @@ public class PacketDownloadHostInfo implements PacketObjectIn<Integer>, PacketOb
@SuppressWarnings("unchecked")
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<String>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
}
}

View File

@ -39,7 +39,6 @@ public class PacketDownloadPlatformInfo implements PacketObjectIn<Integer>, Pack
@SuppressWarnings("unchecked")
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<String>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
}
}

View File

@ -63,7 +63,6 @@ public class PacketDownloadPlayerInfo implements PacketObjectIn<Integer>, Packet
@SuppressWarnings("unchecked")
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<String>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
}
}

View File

@ -50,13 +50,12 @@ public class PacketDownloadProxyInfo implements PacketObjectIn<Integer>, PacketO
@SuppressWarnings("unchecked")
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) {
for (Consumer<ObjectMap<String>> callback : callbacks.remove(data.getUUID(0x0000))) {
ObjectMap<String> map = new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001));
ObjectMap<String> master = (data.contains(0x0002))?new ObjectMap<String>((Map<String, ?>) data.getObject(0x0002)):null;
if (master != null) map.set(master.getString("name"), master);
callback.accept(map);
}
callbacks.remove(data.getUUID(0x0000));
}
}

View File

@ -50,7 +50,6 @@ public class PacketDownloadServerInfo implements PacketObjectIn<Integer>, Packet
@SuppressWarnings("unchecked")
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<String>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<String>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(new ObjectMap<String>((Map<String, ?>) data.getObject(0x0001)));
}
}

View File

@ -59,7 +59,6 @@ public class PacketEditServer implements PacketObjectIn<Integer>, PacketObjectOu
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -53,7 +53,6 @@ public class PacketMessagePlayer implements PacketObjectIn<Integer>, PacketObjec
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -54,7 +54,6 @@ public class PacketRemoveServer implements PacketObjectIn<Integer>, PacketObject
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -51,7 +51,6 @@ public class PacketRestartServer implements PacketObjectIn<Integer>, PacketObjec
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -51,7 +51,6 @@ public class PacketStartServer implements PacketObjectIn<Integer>, PacketObjectO
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -55,7 +55,6 @@ public class PacketStopServer implements PacketObjectIn<Integer>, PacketObjectOu
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -51,7 +51,6 @@ public class PacketTransferPlayer implements PacketObjectIn<Integer>, PacketObje
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -78,7 +78,6 @@ public class PacketUpdateServer implements PacketObjectIn<Integer>, PacketObject
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
for (Consumer<ObjectMap<Integer>> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data);
callbacks.remove(data.getUUID(0x0000));
for (Consumer<ObjectMap<Integer>> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data);
}
}

View File

@ -49,7 +49,6 @@ public class PacketCheckPermissionResponse implements Forwardable, PacketObjectI
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
for (Consumer<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
callbacks.remove(data.getUUID(0x0000));
for (Consumer<Boolean> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
}
}

View File

@ -132,9 +132,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
if (callbacks.keySet().contains(data.getString(0x0000))) {
List<Consumer<ObjectMap<String>>> callbacks = PacketInExRunEvent.callbacks.get(data.getString(0x0000));
PacketInExRunEvent.callbacks.remove(data.getString(0x0000));
for (Consumer<ObjectMap<String>> callback : callbacks) {
for (Consumer<ObjectMap<String>> callback : PacketInExRunEvent.callbacks.remove(data.getString(0x0000))) {
callback.accept(new ObjectMap<>((Map<String, ?>) data.getObject(0x0001)));
}
}

View File

@ -76,15 +76,15 @@ public final class ExHost {
parser.allowsUnrecognizedOptions();
parser.accepts("v");
parser.accepts("version");
parser.accepts("noconsole");
joptsimple.OptionSet options = parser.parse(args);
if (options.has("version") || options.has("v")) {
Version galaxi = Version.fromString(GalaxiEngine.class.getAnnotation(App.class).version());
Class<?> GalaxiEngine = Class.forName("net.ME1312.Galaxi.Engine.Runtime.Engine");
Version galaxi = Version.fromString(GalaxiEngine.getAnnotation(App.class).version());
Version subservers = Version.fromString(ExHost.class.getAnnotation(App.class).version());
Version galaxibuild = null;
Version subserversbuild = null;
try {
Manifest manifest = new Manifest(GalaxiEngine.class.getResourceAsStream("/META-INF/GalaxiEngine.MF"));
Manifest manifest = new Manifest(GalaxiEngine.getResourceAsStream("/META-INF/GalaxiEngine.MF"));
if (manifest.getMainAttributes().getValue("Implementation-Version") != null && manifest.getMainAttributes().getValue("Implementation-Version").length() > 0)
galaxibuild = new Version(manifest.getMainAttributes().getValue("Implementation-Version"));
} catch (Exception e) {} try {
@ -95,7 +95,7 @@ public final class ExHost {
System.out.println("");
System.out.println(Platform.getSystemName() + ' ' + Platform.getSystemVersion() + ((Platform.getSystemBuild() != null)?" (" + Platform.getSystemBuild() + ')':"") + ((!Platform.getSystemArchitecture().equals("unknown"))?" [" + Platform.getSystemArchitecture() + ']':"") + ',');
System.out.println("Java " + Platform.getJavaVersion() + ((!Platform.getJavaArchitecture().equals("unknown"))?" [" + Platform.getJavaArchitecture() + ']':"") + ',');
System.out.println(GalaxiEngine.class.getAnnotation(App.class).name() + " v" + galaxi.toExtendedString() + ((galaxibuild != null)?" (" + galaxibuild + ')':"") + ',');
System.out.println(GalaxiEngine.getAnnotation(App.class).name() + " v" + galaxi.toExtendedString() + ((galaxibuild != null)?" (" + galaxibuild + ')':"") + ',');
System.out.println(ExHost.class.getAnnotation(App.class).name() + " v" + subservers.toExtendedString() + ((subserversbuild != null)?" (" + subserversbuild + ')':""));
System.out.println("");
} else {

View File

@ -46,7 +46,6 @@ public class PacketCheckPermissionResponse implements Forwardable, PacketObjectI
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
for (Consumer<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
callbacks.remove(data.getUUID(0x0000));
for (Consumer<Boolean> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
}
}

View File

@ -129,9 +129,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
if (callbacks.keySet().contains(data.getString(0x0000))) {
List<Consumer<ObjectMap<String>>> callbacks = PacketInExRunEvent.callbacks.get(data.getString(0x0000));
PacketInExRunEvent.callbacks.remove(data.getString(0x0000));
for (Consumer<ObjectMap<String>> callback : callbacks) {
for (Consumer<ObjectMap<String>> callback : PacketInExRunEvent.callbacks.remove(data.getString(0x0000))) {
callback.accept(new ObjectMap<>((Map<String, ?>) data.getObject(0x0001)));
}
}

View File

@ -81,7 +81,6 @@ public final class Launch {
System.out.println("*******************************************");
}
System.out.println("");
}
ExProxy plugin = new ExProxy(System.out, patched);
net.md_5.bungee.api.ProxyServer.class.getMethod("setInstance", net.md_5.bungee.api.ProxyServer.class).invoke(null, plugin);
@ -110,3 +109,4 @@ public final class Launch {
}
}
}
}

View File

@ -49,7 +49,6 @@ public class PacketCheckPermissionResponse implements Forwardable, PacketObjectI
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
for (Consumer<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
callbacks.remove(data.getUUID(0x0000));
for (Consumer<Boolean> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
}
}

View File

@ -131,9 +131,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
if (callbacks.keySet().contains(data.getString(0x0000))) {
List<Consumer<ObjectMap<String>>> callbacks = PacketInExRunEvent.callbacks.get(data.getString(0x0000));
PacketInExRunEvent.callbacks.remove(data.getString(0x0000));
for (Consumer<ObjectMap<String>> callback : callbacks) {
for (Consumer<ObjectMap<String>> callback : PacketInExRunEvent.callbacks.remove(data.getString(0x0000))) {
callback.accept(new ObjectMap<>((Map<String, ?>) data.getObject(0x0001)));
}
}

View File

@ -48,7 +48,6 @@ public class PacketCheckPermissionResponse implements Forwardable, PacketObjectI
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) throws Throwable {
for (Consumer<Boolean> callback : callbacks.get(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
callbacks.remove(data.getUUID(0x0000));
for (Consumer<Boolean> callback : callbacks.remove(data.getUUID(0x0000))) callback.accept(data.getBoolean(0x0001));
}
}

View File

@ -129,9 +129,7 @@ public class PacketInExRunEvent implements PacketObjectIn<Integer> {
@Override
public void receive(SubDataSender client, ObjectMap<Integer> data) {
if (callbacks.keySet().contains(data.getString(0x0000))) {
List<Consumer<ObjectMap<String>>> callbacks = PacketInExRunEvent.callbacks.get(data.getString(0x0000));
PacketInExRunEvent.callbacks.remove(data.getString(0x0000));
for (Consumer<ObjectMap<String>> callback : callbacks) {
for (Consumer<ObjectMap<String>> callback : PacketInExRunEvent.callbacks.remove(data.getString(0x0000))) {
callback.accept(new ObjectMap<>((Map<String, ?>) data.getObject(0x0001)));
}
}