fix
All checks were successful
/ Auto-Build-App (push) Successful in 1m30s

This commit is contained in:
pietru 2024-11-03 11:15:39 +01:00
parent e86c78ac2b
commit b14ec35f42

View file

@ -30,7 +30,25 @@ public class MessagePacketMixin {
@Inject(method = "handle", at = @At("HEAD"), cancellable = true)
private void event_on_message(CallbackInfo ci, @Local NetworkIdentity identity, @Local ChannelHandlerContext ctx){
if (identity.getSide() != NetworkSide.CLIENT && ci.isCancelled()) {
if (ply_msgs.containsKey(playerUniqueId)){
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 += 500;
if (msg.msg_delay>10000)
msg.msg_delay=10000;
ci.cancel();
} else {
msg.msg_delay = 500;
msg.last_msg_txt = message;
}
msg.last_msg = System.currentTimeMillis();
} else {
ply_msgs.put(playerUniqueId,new MessageInfo());
}
if (identity.getSide() != NetworkSide.CLIENT && !ci.isCancelled()) {
Account account = ServerSingletons.getAccount(identity);
if (message.startsWith(":")) {
String cmd = message.replaceFirst(":","");
@ -50,23 +68,5 @@ public class MessagePacketMixin {
}
}
}
if (ply_msgs.containsKey(playerUniqueId)){
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 += 500;
if (msg.msg_delay>10000)
msg.msg_delay=10000;
ci.cancel();
} else {
msg.msg_delay = 500;
msg.last_msg_txt = message;
}
msg.last_msg = System.currentTimeMillis();
} else {
ply_msgs.put(playerUniqueId,new MessageInfo());
}
}
}