How can I block that if a player writes: example: BLABLA and if his next message is the same to the first message it gets cancelled. I think I will use PlayerChatEvent for this action.
Create a HashMap<Player, String> Check if the hashmap is null, and does not compare to the latest message from the player Then if it's null, and don't match then put the player, and the event.getMessage in the hashmap else if it's not null, and compares to the latest message, then cancel You can remove the message from the hashmap using PlayerQuitEvent, because you don't want it to be there the next time the player connects. Also if you want it a bit more advanced, then you can use schedulers to remove the message after 3 seconds. That way the player would have to wait 3 seconds before typing the same message.. You can read more about schedulers here! also if you want, make a counter for how many times the player typed the same message, and Just add the message to the hashmap after 3 times
@AdobeGFX I assume you are not talking for a long term stored hashmap. If you do, you need to remind the op to handle the disconnects of the players apropriately.