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

This commit is contained in:
pietru 2024-11-03 00:22:53 +01:00
parent c216315cf0
commit e86c78ac2b
2 changed files with 19 additions and 19 deletions

View file

@ -4,7 +4,7 @@ org.gradle.parallel=true
org.gradle.caching=false
# Project Info
version=1.0.1
version=1.0.2
group=net.pietru
id=cookie_utils

View file

@ -30,24 +30,6 @@ 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 (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(":")) {
@ -68,5 +50,23 @@ 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());
}
}
}