Update PacketExSyncPlayer

This commit is contained in:
ME1312 2021-11-24 04:52:39 -05:00
parent c137906fcd
commit a0b8df47ac
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
3 changed files with 16 additions and 16 deletions

View File

@ -76,10 +76,10 @@ public class PacketExSyncPlayer implements PacketObjectIn<Integer>, PacketObject
}
}
if (data.getBoolean(0x0001) != Boolean.FALSE) {
if (data.contains(0x0002)) for (Map<String, Object> object : (List<Map<String, Object>>) data.getObjectList(0x0002)) {
Server server = (object.getOrDefault("server", null) != null)?plugin.api.getServer(object.get("server").toString()):null;
RemotePlayer player = new RemotePlayer(object.get("name").toString(), UUID.fromString(object.get("id").toString()), (Proxy) client.getHandler(), server,
new InetSocketAddress(object.get("address").toString().split(":")[0], Integer.parseInt(object.get("address").toString().split(":")[1])));
if (data.contains(0x0002)) for (ObjectMap<String> object : (List<ObjectMap<String>>) (List<?>) data.getMapList(0x0002)) {
Server server = (object.contains("server"))?plugin.api.getServer(object.getString("server")):null;
RemotePlayer player = new RemotePlayer(object.getString("name"), object.getUUID("id"), (Proxy) client.getHandler(), server,
new InetSocketAddress(object.getString("address").split(":")[0], Integer.parseInt(object.getString("address").split(":")[1])));
forward.add(player);
plugin.rPlayerLinkP.put(player.getUniqueId(), (Proxy) client.getHandler());
@ -87,8 +87,8 @@ public class PacketExSyncPlayer implements PacketObjectIn<Integer>, PacketObject
if (server != null) plugin.rPlayerLinkS.put(player.getUniqueId(), server);
}
} else {
if (data.contains(0x0002)) for (Map<String, Object> object : (List<Map<String, Object>>) data.getObjectList(0x0002)) {
UUID id = UUID.fromString(object.get("id").toString());
if (data.contains(0x0002)) for (ObjectMap<String> object : (List<ObjectMap<String>>) (List<?>) data.getMapList(0x0002)) {
UUID id = object.getUUID("id");
RemotePlayer player = plugin.rPlayers.get(id);
// Don't accept removal requests from non-managing proxies

View File

@ -68,17 +68,17 @@ public class PacketExSyncPlayer implements PacketObjectIn<Integer>, PacketObject
}
}
if (data.getBoolean(0x0001) != Boolean.FALSE) {
if (data.contains(0x0002)) for (Map<String, Object> object : (List<Map<String, Object>>) data.getObjectList(0x0002)) {
ServerImpl server = (object.getOrDefault("server", null) != null)?plugin.servers.getOrDefault(object.get("server").toString().toLowerCase(), null):null;
CachedPlayer player = new CachedPlayer(new ObjectMap<>(object));
if (data.contains(0x0002)) for (ObjectMap<String> object : (List<ObjectMap<String>>) (List<?>) data.getMapList(0x0002)) {
ServerImpl server = (object.contains("server"))?plugin.servers.getOrDefault(object.getString("server").toLowerCase(), null):null;
CachedPlayer player = new CachedPlayer(object);
plugin.rPlayerLinkP.put(player.getUniqueId(), proxy);
plugin.rPlayers.put(player.getUniqueId(), player);
if (server != null) plugin.rPlayerLinkS.put(player.getUniqueId(), server);
}
} else {
if (data.contains(0x0002)) for (Map<String, Object> object : (List<Map<String, Object>>) data.getObjectList(0x0002)) {
UUID id = UUID.fromString(object.get("id").toString());
if (data.contains(0x0002)) for (ObjectMap<String> object : (List<ObjectMap<String>>) (List<?>) data.getMapList(0x0002)) {
UUID id = object.getUUID("id");
// Don't accept removal requests when we're managing players
if ((!plugin.rPlayerLinkP.containsKey(id) || !plugin.rPlayerLinkP.get(id).equalsIgnoreCase(plugin.api.getName().toLowerCase()))) {

View File

@ -70,17 +70,17 @@ public class PacketExSyncPlayer implements PacketObjectIn<Integer>, PacketObject
}
}
if (data.getBoolean(0x0001) != Boolean.FALSE) {
if (data.contains(0x0002)) for (Map<String, Object> object : (List<Map<String, Object>>) data.getObjectList(0x0002)) {
ServerData server = (object.getOrDefault("server", null) != null)?ExProxy.getInstance().getServer(object.get("server").toString()).map(RegisteredServer::getServerInfo).map(plugin::getData).orElse(null):null;
CachedPlayer player = new CachedPlayer(new ObjectMap<>(object));
if (data.contains(0x0002)) for (ObjectMap<String> object : (List<ObjectMap<String>>) (List<?>) data.getMapList(0x0002)) {
ServerData server = (object.contains("server"))?ExProxy.getInstance().getServer(object.getString("server")).map(RegisteredServer::getServerInfo).map(plugin::getData).orElse(null):null;
CachedPlayer player = new CachedPlayer(object);
plugin.rPlayerLinkP.put(player.getUniqueId(), proxy);
plugin.rPlayers.put(player.getUniqueId(), player);
if (server != null) plugin.rPlayerLinkS.put(player.getUniqueId(), server);
}
} else {
if (data.contains(0x0002)) for (Map<String, Object> object : (List<Map<String, Object>>) data.getObjectList(0x0002)) {
UUID id = UUID.fromString(object.get("id").toString());
if (data.contains(0x0002)) for (ObjectMap<String> object : (List<ObjectMap<String>>) (List<?>) data.getMapList(0x0002)) {
UUID id = object.getUUID("id");
// Don't accept removal requests when we're managing players
if ((!plugin.rPlayerLinkP.containsKey(id) || !plugin.rPlayerLinkP.get(id).equalsIgnoreCase(plugin.api.getName().toLowerCase()))) {