mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 10:15:52 +01:00
Rebuild local RemotePlayer cache before reconnecting
This commit is contained in:
parent
a3896eccd4
commit
5d3664cbc7
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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());
|
||||
|
@ -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();
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user