Sanitize join & leave usernames

This commit is contained in:
Business Goose 2022-03-29 22:26:12 +01:00
parent bd564798f0
commit 1f3a900e61
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)) { 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); PlayerList.removeEntry(player);
@ -771,6 +771,7 @@ public class PlayerListener implements Listener {
final String ip = Utilities.getIp(player); final String ip = Utilities.getIp(player);
final Player playerEntry; final Player playerEntry;
Log.info("[JOIN] " + Utilities.formatPlayer(player) + " joined the game with IP address: " + ip, true); Log.info("[JOIN] " + Utilities.formatPlayer(player) + " joined the game with IP address: " + ip, true);
// Check absolute value to account for negatives // Check absolute value to account for negatives
if (Math.abs(player.getLocation().getX()) >= MAX_XY_COORD || Math.abs(player.getLocation().getZ()) >= MAX_XY_COORD) 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); 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) @EventHandler(priority = EventPriority.HIGHEST)