From 4b38ed7c54aa77327cd6aab23e0b014d726c1dac Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 6 May 2023 21:18:24 +0200 Subject: [PATCH] Hotfix TeamCommand.tp --- src/de/steamwar/bungeecore/commands/TeamCommand.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index adbab80..026e13f 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -515,12 +515,21 @@ public class TeamCommand extends SWCommand { Message.send("TEAM_NO_ADDRESS", player); return; } + + InetSocketAddress address = new InetSocketAddress(targetTeam.getAddress(), targetTeam.getPort()); ServerInfo serverInfo = Storage.teamServers.computeIfAbsent(targetTeam.getTeamId(), integer -> { - InetSocketAddress address = new InetSocketAddress(targetTeam.getAddress(), targetTeam.getPort()); ServerInfo info = ProxyServer.getInstance().constructServerInfo("Team " + targetTeam.getTeamKuerzel(), address, "SteamWar.de - Teamserver", false); ProxyServer.getInstance().getServers().put(info.getName(), info); return info; }); + + if (!address.equals(serverInfo.getSocketAddress())) { + serverInfo = Storage.teamServers.remove(targetTeam.getTeamId()); + ProxyServer.getInstance().getServers().remove(serverInfo.getName()); + tp(player, targetTeam); + return; + } + player.connect(ServerConnectRequest.builder() .target(serverInfo) .connectTimeout(BungeeCord.getInstance().getConfig().getServerConnectTimeout())