Skip to content

Commit

Permalink
Ignore invalid nicknames in AntiVanish (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
chiteroman authored May 15, 2024
1 parent f204244 commit 3a6a0d8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/anticope/rejects/modules/AntiVanish.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@ private void onPacket(PacketEvent.Receive event) {

for (String playerName : completionPlayerCache) {
if (Objects.equals(playerName, mc.player.getName().getString())) continue;
if (playerName.contains(" ")) continue;
if (playerName.length() < 3 || playerName.length() > 16) continue;
if (joinedOrQuit.test(playerName)) {
info("Player joined: " + playerName);
}
}

for (String playerName : lastUsernames) {
if (Objects.equals(playerName, mc.player.getName().getString())) continue;
if (playerName.contains(" ")) continue;
if (playerName.length() < 3 || playerName.length() > 16) continue;
if (joinedOrQuit.test(playerName)) {
info("Player left: " + playerName);
}
Expand Down Expand Up @@ -124,6 +128,8 @@ private void onTick(TickEvent.Post event) {
for (UUID uuid : oldPlayers.keySet()) {
if (playerCache.containsKey(uuid)) continue;
String name = oldPlayers.get(uuid);
if (name.contains(" ")) continue;
if (name.length() < 3 || name.length() > 16) continue;
if (messageCache.stream().noneMatch(s -> s.contains(name))) {
warning(name + " has gone into vanish.");
}
Expand Down

0 comments on commit 3a6a0d8

Please sign in to comment.