Merge pull request #161 from VelocityPowered/anonymize-user-disconnect-messages

Anonymize all exception/connection-related errors from the user.
This commit is contained in:
Andrew Steinborn 2018-12-14 13:11:51 -05:00 committed by GitHub
commit 9a15a80627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -306,20 +306,17 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
wrapped = cause;
}
}
String error = ThrowableUtils.briefDescription(wrapped);
String userMessage;
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 {
logger.error("{}: unable to connect to server {}", this, server.getServerInfo().getName(),
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()
.content(userMessage + ": ")
.color(TextColor.RED)
.append(TextComponent.of(error, TextColor.WHITE))
.build());
handleConnectionException(server, null, TextComponent.of(userMessage, TextColor.RED));
}
public void handleConnectionException(RegisteredServer server, Disconnect disconnect) {