Rebuild local RemotePlayer cache before reconnecting

This commit is contained in:
ME1312 2021-10-06 14:11:26 -04:00
parent a3896eccd4
commit 5d3664cbc7
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
4 changed files with 30 additions and 3 deletions

View File

@ -5,7 +5,6 @@ import net.ME1312.Galaxi.Library.Util;
import net.ME1312.SubServers.Bungee.Library.Compatibility.JNA;
import java.io.File;
import java.io.IOException;
import java.util.stream.Stream;
/**

View File

@ -661,6 +661,15 @@ public final class SubProxy extends BungeeCommon implements Listener {
try {
if (posted || !ready) reload();
synchronized (rPlayers) {
for (ProxiedPlayer local : getPlayers()) {
RemotePlayer player = new RemotePlayer(local);
rPlayerLinkP.put(player.getUniqueId(), player.getProxy());
rPlayers.put(player.getUniqueId(), player);
if (player.getServer() != null) rPlayerLinkS.put(player.getUniqueId(), player.getServer());
}
}
if (UPnP.isUPnPAvailable()) {
if (config.get().getMap("Settings").getMap("UPnP", new ObjectMap<String>()).getBoolean("Forward-Proxy", true)) for (ListenerInfo listener : getConfig().getListeners()) {
UPnP.openPortTCP(listener.getHost().getPort());

View File

@ -168,6 +168,15 @@ public final class ExProxy extends BungeeCommon implements Listener {
ConfigUpdater.updateConfig(new UniversalFile(dir, "SubServers:sync.yml"));
config.reload();
synchronized (rPlayers) {
for (ProxiedPlayer local : getPlayers()) {
CachedPlayer player = new CachedPlayer(local);
rPlayerLinkP.put(player.getUniqueId(), player.getProxyName().toLowerCase());
rPlayers.put(player.getUniqueId(), player);
if (local.getServer().getInfo() instanceof ServerImpl) rPlayerLinkS.put(player.getUniqueId(), (ServerImpl) local.getServer().getInfo());
}
}
subprotocol.unregisterCipher("AES");
subprotocol.unregisterCipher("AES-128");
subprotocol.unregisterCipher("AES-192");
@ -198,8 +207,6 @@ public final class ExProxy extends BungeeCommon implements Listener {
Logger.get("SubData").info("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
connect(Logger.get("SubData"), null);
super.startListeners();
if (UPnP.isUPnPAvailable()) {
if (config.get().getMap("Settings").getMap("UPnP", new ObjectMap<String>()).getBoolean("Forward-Proxy", true)) for (ListenerInfo listener : getConfig().getListeners()) {
UPnP.openPortTCP(listener.getHost().getPort());
@ -208,6 +215,8 @@ public final class ExProxy extends BungeeCommon implements Listener {
getLogger().warning("UPnP is currently unavailable. Ports may not be automatically forwarded on this device.");
}
super.startListeners();
if (!posted) {
posted = true;
post();

View File

@ -138,6 +138,16 @@ public class ExProxy {
ConfigUpdater.updateConfig(new UniversalFile(dir, "SubServers:sync.yml"));
config.reload();
synchronized (rPlayers) {
for (Player local : proxy.getAllPlayers()) {
CachedPlayer player = new CachedPlayer(local);
rPlayerLinkP.put(player.getUniqueId(), player.getProxyName().toLowerCase());
rPlayers.put(player.getUniqueId(), player);
ServerInfo server = local.getCurrentServer().map(ServerConnection::getServerInfo).orElse(null);
if (servers.containsKey(server)) rPlayerLinkS.put(player.getUniqueId(), servers.get(server));
}
}
subprotocol.unregisterCipher("AES");
subprotocol.unregisterCipher("AES-128");
subprotocol.unregisterCipher("AES-192");