Skip to content
This repository was archived by the owner on Jun 7, 2022. It is now read-only.

Commit 038845d

Browse files
author
Dytanic
committed
possible fix for the already conncted player if the player is not connected
1 parent dd1327d commit 038845d

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

cloudnet-api/cloudnet-api-bridge/src/main/java/de/dytanic/cloudnet/bridge/ProxiedBootstrap.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import de.dytanic.cloudnet.bridge.internal.command.proxied.CommandPermissions;
1414
import de.dytanic.cloudnet.bridge.internal.command.proxied.defaults.CommandIp;
1515
import de.dytanic.cloudnet.bridge.internal.listener.proxied.ProxiedListener;
16-
import de.dytanic.cloudnet.bridge.internal.packetio.PacketOutProxyPing;
1716
import de.dytanic.cloudnet.lib.utility.CollectionWrapper;
1817
import de.dytanic.cloudnet.lib.utility.threading.Runnabled;
1918
import net.md_5.bungee.api.ProxyServer;
@@ -87,9 +86,9 @@ public void run()
8786
@Override
8887
public void run()
8988
{
90-
CloudAPI.getInstance().getNetworkConnection().sendPacket(new PacketOutProxyPing());
89+
CloudProxy.getInstance().update();
9190
}
92-
}, 0, 1, TimeUnit.MINUTES);
91+
}, 0, 1, TimeUnit.SECONDS);
9392
}
9493

9594
@Override

cloudnet-api/cloudnet-api-bridge/src/main/java/de/dytanic/cloudnet/bridge/internal/packetio/PacketOutProxyPing.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

cloudnet-api/cloudnet-api-core/src/main/java/de/dytanic/cloudnet/api/CloudAPI.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,13 @@ public void shutdown()
114114
this.networkConnection.tryDisconnect();
115115
}
116116

117-
@Deprecated
118117
public CloudAPI update(ServerInfo serverInfo)
119118
{
120119
if (networkConnection.isConnected())
121120
networkConnection.sendPacket(new PacketOutUpdateServerInfo(serverInfo));
122121
return this;
123122
}
124123

125-
@Deprecated
126124
public CloudAPI update(ProxyInfo proxyInfo)
127125
{
128126
if (networkConnection.isConnected())

cloudnet-core/src/main/java/de/dytanic/cloudnetcore/network/NetworkManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import de.dytanic.cloudnetcore.util.MessageConfig;
4242
import lombok.Getter;
4343

44+
import java.util.ArrayList;
4445
import java.util.Collection;
4546
import java.util.LinkedList;
4647
import java.util.UUID;
@@ -218,6 +219,16 @@ public void handleProxyInfoUpdate(ProxyServer proxyServer, ProxyInfo incoming)
218219
{
219220
CloudNet.getInstance().getEventManager().callEvent(new ProxyInfoUpdateEvent(proxyServer, incoming));
220221

222+
Collection<UUID> players = new ArrayList<>();
223+
224+
for (ProxyServer proxy : CloudNet.getInstance().getProxys().values())
225+
for (MultiValue<UUID, String> multiValue : proxy.getProxyInfo().getPlayers())
226+
players.add(multiValue.getFirst());
227+
228+
for (CloudPlayer cloudPlayer : this.onlinePlayers.values())
229+
if (!players.contains(cloudPlayer.getUniqueId()))
230+
this.onlinePlayers.remove(cloudPlayer.getUniqueId());
231+
221232
this.sendAllUpdate(new PacketOutUpdateProxyInfo(incoming));
222233
this.sendAll(new PacketOutUpdateOnlineCount(getOnlineCount()));
223234
}

0 commit comments

Comments
 (0)