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