protect against msg attack
All checks were successful
/ Auto-Build-App (push) Successful in 1m50s

This commit is contained in:
pietru 2024-11-03 00:04:01 +01:00
parent 6de72981e6
commit c216315cf0

View file

@ -34,13 +34,16 @@ public class MessagePacketMixin {
MessageInfo msg = ply_msgs.get(playerUniqueId);
long time = System.currentTimeMillis();
if (msg.last_msg+msg.msg_delay>time || msg.last_msg_txt.equals(message)) {
msg.msg_delay += 1000;
msg.msg_delay += 500;
if (msg.msg_delay>10000)
msg.msg_delay=10000;
ci.cancel();
} else
msg.msg_delay=1000;
} else {
msg.msg_delay = 500;
msg.last_msg_txt = message;
}
msg.last_msg = System.currentTimeMillis();
msg.last_msg_txt=message;
} else {
ply_msgs.put(playerUniqueId,new MessageInfo());
}