This commit is contained in:
parent
c216315cf0
commit
e86c78ac2b
2 changed files with 19 additions and 19 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue