Skip to content

Commit

Permalink
feat: Fix async
Browse files Browse the repository at this point in the history
  • Loading branch information
HaHaWTH committed Mar 11, 2024
1 parent 65c8fb5 commit a43bb00
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
18 changes: 12 additions & 6 deletions src/main/java/io/wdsj/asw/listener/packet/ASWPacketListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ public void onPacketReceive(PacketReceiveEvent event) {
}
long endTime = System.currentTimeMillis();
addProcessStatistic(endTime, startTime);
Notifier.notice(player, EventType.CHAT, originalMessage);
Punishment.punish(player);
getScheduler().runTask(()-> {
Notifier.notice(player, EventType.CHAT, originalMessage);
Punishment.punish(player);
});
return;
}

Expand Down Expand Up @@ -109,8 +111,10 @@ public void onPacketReceive(PacketReceiveEvent event) {
}
long endTime = System.currentTimeMillis();
addProcessStatistic(endTime, startTime);
Notifier.notice(player, EventType.CHAT, originalContext);
Punishment.punish(player);
getScheduler().runTask(()-> {
Notifier.notice(player, EventType.CHAT, originalContext);
Punishment.punish(player);
});
}
}
} else if (packetType == PacketType.Play.Client.CHAT_COMMAND) {
Expand Down Expand Up @@ -143,8 +147,10 @@ public void onPacketReceive(PacketReceiveEvent event) {
}
long endTime = System.currentTimeMillis();
addProcessStatistic(endTime, startTime);
Notifier.notice(player, EventType.CHAT, "/" + originalCommand);
Punishment.punish(player);
getScheduler().runTask(()-> {
Notifier.notice(player, EventType.CHAT, originalCommand);
Punishment.punish(player);
});
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ public void onPacketReceiving(@NotNull com.comphenix.protocol.events.PacketEvent
}
long endTime = System.currentTimeMillis();
addProcessStatistic(endTime, startTime);
Notifier.notice(player, EventType.CHAT, message);
Punishment.punish(player);
getScheduler().runTask(()-> {
Notifier.notice(player, EventType.CHAT, message);
Punishment.punish(player);
});
return;
}

Expand All @@ -103,8 +105,10 @@ public void onPacketReceiving(@NotNull com.comphenix.protocol.events.PacketEvent
}
long endTime = System.currentTimeMillis();
addProcessStatistic(endTime, startTime);
Notifier.notice(player, EventType.CHAT, originalContext);
Punishment.punish(player);
getScheduler().runTask(()-> {
Notifier.notice(player, EventType.CHAT, originalContext);
Punishment.punish(player);
});
}
}
}
Expand Down

0 comments on commit a43bb00

Please sign in to comment.