Archiviert
1
0

Fix TeamCommand tp no message

Dieser Commit ist enthalten in:
yoyosource 2022-05-28 13:29:18 +02:00
Ursprung f45ed11a59
Commit 300a2ef502
4 geänderte Dateien mit 13 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -88,6 +88,7 @@ public class ErrorLogger extends Handler {
contains.add("read timed out");
contains.add("Connection reset by peer");
contains.add("No client connected for pending server");
contains.add("Error occurred processing connection for");
ignoreContains = Collections.unmodifiableList(contains);
}
}

Datei anzeigen

@ -26,6 +26,8 @@ import de.steamwar.bungeecore.inventory.SWListInv;
import de.steamwar.bungeecore.sql.*;
import de.steamwar.messages.ChatSender;
import io.netty.channel.ConnectTimeoutException;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.UserConnection;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
@ -35,6 +37,7 @@ import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.ServerConnectEvent;
import java.net.*;
import java.time.Instant;
@ -587,18 +590,13 @@ public class TeamCommand extends BasicCommand {
ProxyServer.getInstance().getServers().put(info.getName(), info);
return info;
});
try {
player.connect(serverInfo, (success, error) -> {
if (error != null) {
error.printStackTrace();
}
((UserConnection) player).connect(serverInfo, (success, error) -> {
if (error instanceof ConnectTimeoutException) {
Message.send("TEAM_TIMEOUT", player);
} else if (error != null) {
Message.send("TEAM_UNKNOWN", player);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}, false, ServerConnectEvent.Reason.PLUGIN, BungeeCord.getInstance().getConfig().getServerConnectTimeout(), false);
}
private void server(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){

Datei anzeigen

@ -479,6 +479,7 @@ TEAM_SERVER_PORT_INVALID=§cInvalid port number.
TEAM_SERVER_ADDRESS_INVALID=§cInvalid address.
TEAM_NO_ADDRESS=§cNo team server address set.
TEAM_TIMEOUT=§cTeam server may be offline.
TEAM_UNKNOWN=§cAn unexpected error occurred while connecting to the team server.
TEAM_TP_NO_TEAM=§cUnknown team.
#TpCommand

Datei anzeigen

@ -458,6 +458,7 @@ TEAM_SERVER_PORT_INVALID=§cUnmögliche Portnummer.
TEAM_SERVER_ADDRESS_INVALID=§cUngültige Adresse.
TEAM_NO_ADDRESS=§cTeamserveradresse nicht gesetzt.
TEAM_TIMEOUT=§cTeamserver scheint offline zu sein.
TEAM_UNKNOWN=§cEin unwerwarteter Fehler ist aufgetreten beim verbinden zum Teamserver.
TEAM_TP_NO_TEAM=§cUnbekanntes Team.
#TpCommand