SteamWar/BungeeCore
Archiviert
13
2

Hotfix TeamCommand.tp

Dieser Commit ist enthalten in:
yoyosource 2023-05-06 21:18:24 +02:00
Ursprung ff75a43c11
Commit 4b38ed7c54

Datei anzeigen

@ -515,12 +515,21 @@ public class TeamCommand extends SWCommand {
Message.send("TEAM_NO_ADDRESS", player); Message.send("TEAM_NO_ADDRESS", player);
return; return;
} }
ServerInfo serverInfo = Storage.teamServers.computeIfAbsent(targetTeam.getTeamId(), integer -> {
InetSocketAddress address = new InetSocketAddress(targetTeam.getAddress(), targetTeam.getPort()); InetSocketAddress address = new InetSocketAddress(targetTeam.getAddress(), targetTeam.getPort());
ServerInfo serverInfo = Storage.teamServers.computeIfAbsent(targetTeam.getTeamId(), integer -> {
ServerInfo info = ProxyServer.getInstance().constructServerInfo("Team " + targetTeam.getTeamKuerzel(), address, "SteamWar.de - Teamserver", false); ServerInfo info = ProxyServer.getInstance().constructServerInfo("Team " + targetTeam.getTeamKuerzel(), address, "SteamWar.de - Teamserver", false);
ProxyServer.getInstance().getServers().put(info.getName(), info); ProxyServer.getInstance().getServers().put(info.getName(), info);
return 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() player.connect(ServerConnectRequest.builder()
.target(serverInfo) .target(serverInfo)
.connectTimeout(BungeeCord.getInstance().getConfig().getServerConnectTimeout()) .connectTimeout(BungeeCord.getInstance().getConfig().getServerConnectTimeout())