Minecraft Java Anti Spam?

Ra
2

Can someone tell me my mistake?

One should only send a message once and the second time it should be blocked. However, that does not work that way.

private static string msg = "";

@EventHandler

public void onAntiSpam (AsyncPlayerChatEvent e) {

Player p = e.getPlayer ();

main.msgWdh.toUpperCase ();

if (! (p.hasPermission {"lobby.spam" {

if (e.getMessage (). ToUpperCase () == main.msgWdh) {

e.setCancelled (true);

p.sendMessage (main.prefix + "Please do not spam!");

} else {

main.msgWdh = e.getMessage (). ToUpperCase ();

th

I would make it quite different in spirit somehow.

Lo

Strings are compared to equals and not ==.

if (e.getMessage (). ToUpperCase (). Equals (main.msgWdh)) {