Fix for human-controlled bot spam.
Mutes/bans bots used by a human player to send lots of identical messages using different accounts while varying the message and limiting message speed to work around anti-spam measures.
This commit is contained in:
parent
59f394ab11
commit
cd85562e40
|
|
@ -211,7 +211,7 @@ public class FlatFileDataStore extends DataStore
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
GriefPrevention.AddLogEntry("Failed to look up UUID for player " + ownerName + ".");
|
GriefPrevention.AddLogEntry("Error - this is not a valid UUID: " + ownerName + ".");
|
||||||
GriefPrevention.AddLogEntry(" Converted land claim to administrative @ " + lesserBoundaryCorner.toString());
|
GriefPrevention.AddLogEntry(" Converted land claim to administrative @ " + lesserBoundaryCorner.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,12 @@ class PlayerEventHandler implements Listener
|
||||||
event.setCancelled(this.handlePlayerChat(player, message, event));
|
event.setCancelled(this.handlePlayerChat(player, message, event));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//last chat message shown, regardless of who sent it
|
||||||
|
private String lastChatMessage = "";
|
||||||
|
|
||||||
|
//number of identical messages in a row
|
||||||
|
private int duplicateMessageCount = 0;
|
||||||
|
|
||||||
//returns true if the message should be sent, false if it should be muted
|
//returns true if the message should be sent, false if it should be muted
|
||||||
private boolean handlePlayerChat(Player player, String message, PlayerEvent event)
|
private boolean handlePlayerChat(Player player, String message, PlayerEvent event)
|
||||||
{
|
{
|
||||||
|
|
@ -144,6 +150,19 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//always mute an exact match to the last chat message
|
||||||
|
if(message.equals(this.lastChatMessage))
|
||||||
|
{
|
||||||
|
playerData.spamCount += ++this.duplicateMessageCount;
|
||||||
|
spam = true;
|
||||||
|
muted = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.lastChatMessage = message;
|
||||||
|
this.duplicateMessageCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//where other types of spam are concerned, casing isn't significant
|
//where other types of spam are concerned, casing isn't significant
|
||||||
message = message.toLowerCase();
|
message = message.toLowerCase();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user