Sanitize join & leave usernames

This commit is contained in:
Business Goose 2022-03-29 22:26:12 +01:00
parent 8296201f01
commit a293ae64dd
No known key found for this signature in database
GPG key ID: 77DCA801362E9645

View file

@ -756,7 +756,7 @@ public class PlayerListener implements Listener {
}
if (PlayerList.existsEntry(player)) {
DiscordBridge.transmitMessage(String.format("**%s left the server**", player.getDisplayName()));
DiscordBridge.transmitMessage(String.format("**%s left the server**", DiscordBridge.sanitizeMessage(player.getDisplayName())));
}
PlayerList.removeEntry(player);
@ -771,6 +771,7 @@ public class PlayerListener implements Listener {
final String ip = Utilities.getIp(player);
final Player playerEntry;
Log.info("[JOIN] " + Utilities.formatPlayer(player) + " joined the game with IP address: " + ip, true);
// Check absolute value to account for negatives
if (Math.abs(player.getLocation().getX()) >= MAX_XY_COORD || Math.abs(player.getLocation().getZ()) >= MAX_XY_COORD)
{
@ -907,7 +908,7 @@ public class PlayerListener implements Listener {
PlayerData.getPlayerData(player).setTag(playerTag);
}
}
DiscordBridge.transmitMessage(String.format("**%s joined the server**", player.getDisplayName()));
DiscordBridge.transmitMessage(String.format("**%s joined the server**", DiscordBridge.sanitizeMessage(player.getDisplayName())));
}
@EventHandler(priority = EventPriority.HIGHEST)