Added 1.19 kick event causes (#8204)

This commit is contained in:
Jake Potrebic
2022-07-29 09:31:02 -07:00
parent 5f5f19fe4a
commit 7d25a137c4
4 changed files with 78 additions and 12 deletions

View File

@@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void handleChatCommand(ServerboundChatCommandPacket packet) {
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) {
+ this.server.scheduleOnMain(() -> { // Paper - push to main for event firing
this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper
+ }); // Paper - push to main for event firing
} else {
if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) {
@@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!this.updateChatOrder(timestamp)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message);
+ this.server.scheduleOnMain(() -> { // Paper - push to main
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"));
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event cause
+ }); // Paper - push to main
return false;
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales