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

Commit

Permalink
possible fix for the already conncted player if the player is not con…
Browse files Browse the repository at this point in the history
…nected
  • Loading branch information
Dytanic committed Nov 17, 2018
1 parent dd1327d commit 038845d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import de.dytanic.cloudnet.bridge.internal.command.proxied.CommandPermissions;
import de.dytanic.cloudnet.bridge.internal.command.proxied.defaults.CommandIp;
import de.dytanic.cloudnet.bridge.internal.listener.proxied.ProxiedListener;
import de.dytanic.cloudnet.bridge.internal.packetio.PacketOutProxyPing;
import de.dytanic.cloudnet.lib.utility.CollectionWrapper;
import de.dytanic.cloudnet.lib.utility.threading.Runnabled;
import net.md_5.bungee.api.ProxyServer;
Expand Down Expand Up @@ -87,9 +86,9 @@ public void run()
@Override
public void run()
{
CloudAPI.getInstance().getNetworkConnection().sendPacket(new PacketOutProxyPing());
CloudProxy.getInstance().update();
}
}, 0, 1, TimeUnit.MINUTES);
}, 0, 1, TimeUnit.SECONDS);
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,13 @@ public void shutdown()
this.networkConnection.tryDisconnect();
}

@Deprecated

This comment has been minimized.

Copy link
@einrobin

einrobin Apr 24, 2019

Contributor

Why did you remove the Deprecated from those two update methods? They shouldn't be used by the users because it updates the Server/ProxyInfo to the server that sent the packet, this could cause some errors because the name of a server/proxy would get changed to the name of the sender of the packet.

This comment has been minimized.

Copy link
@juliarn

juliarn Apr 24, 2019

Contributor

There should be documentation for the deprecates

public CloudAPI update(ServerInfo serverInfo)
{
if (networkConnection.isConnected())
networkConnection.sendPacket(new PacketOutUpdateServerInfo(serverInfo));
return this;
}

@Deprecated
public CloudAPI update(ProxyInfo proxyInfo)
{
if (networkConnection.isConnected())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import de.dytanic.cloudnetcore.util.MessageConfig;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.UUID;
Expand Down Expand Up @@ -218,6 +219,16 @@ public void handleProxyInfoUpdate(ProxyServer proxyServer, ProxyInfo incoming)
{
CloudNet.getInstance().getEventManager().callEvent(new ProxyInfoUpdateEvent(proxyServer, incoming));

Collection<UUID> players = new ArrayList<>();

for (ProxyServer proxy : CloudNet.getInstance().getProxys().values())
for (MultiValue<UUID, String> multiValue : proxy.getProxyInfo().getPlayers())
players.add(multiValue.getFirst());

for (CloudPlayer cloudPlayer : this.onlinePlayers.values())
if (!players.contains(cloudPlayer.getUniqueId()))
this.onlinePlayers.remove(cloudPlayer.getUniqueId());

this.sendAllUpdate(new PacketOutUpdateProxyInfo(incoming));
this.sendAll(new PacketOutUpdateOnlineCount(getOnlineCount()));
}
Expand Down

0 comments on commit 038845d

Please sign in to comment.