13
0
geforkt von Mirrors/Velocity

Anonymize all exception/connection-related errors from the user.

We still print these out in the logs.
Dieser Commit ist enthalten in:
Andrew Steinborn 2018-12-11 01:50:29 -05:00
Ursprung 7c065e5c15
Commit f9843057ba

Datei anzeigen

@ -306,20 +306,17 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
wrapped = cause; wrapped = cause;
} }
} }
String error = ThrowableUtils.briefDescription(wrapped);
String userMessage; String userMessage;
if (connectedServer != null && connectedServer.getServerInfo().equals(server.getServerInfo())) { if (connectedServer != null && connectedServer.getServerInfo().equals(server.getServerInfo())) {
userMessage = "Exception in server " + server.getServerInfo().getName(); userMessage = "Your connection to " + server.getServerInfo().getName() + " encountered an "
+ " error.";
} else { } else {
logger.error("{}: unable to connect to server {}", this, server.getServerInfo().getName(), logger.error("{}: unable to connect to server {}", this, server.getServerInfo().getName(),
wrapped); wrapped);
userMessage = "Can't connect to server " + server.getServerInfo().getName(); userMessage = "Unable to connect to " + server.getServerInfo().getName() + ". Try again "
+ "later.";
} }
handleConnectionException(server, null, TextComponent.builder() handleConnectionException(server, null, TextComponent.of(userMessage, TextColor.RED));
.content(userMessage + ": ")
.color(TextColor.RED)
.append(TextComponent.of(error, TextColor.WHITE))
.build());
} }
public void handleConnectionException(RegisteredServer server, Disconnect disconnect) { public void handleConnectionException(RegisteredServer server, Disconnect disconnect) {