Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Cancelling AsyncPlayerChatEvent causes players to be kicked

Open SnickoDeadMC opened this issue 4 years ago • 14 comments

Expected behavior

Cancelling the AsyncPlayerChatEvent event should not send any messages (like in pre 1.19 builds)

Observed/Actual behavior

Cancelling the AsyncPlayerChatEvent event will cause players to be kicked when sending any chat message, with kick message: "Chat message validation failure.".

Steps/models to reproduce

Cancel the AsyncPlayerChatEvent event and attempt to send a message.

Plugin and Datapack List

This is a custom plugin we use for chat. No other notable plugins.

Paper version

1.19.2 #119

Other

No response

SnickoDeadMC avatar Aug 09 '22 12:08 SnickoDeadMC

Can't reproduce using the following snippet:

@EventHandler
public void asyncplayerchat(AsyncPlayerChatEvent e) {
    e.setCancelled(true);
}

NoahvdAa avatar Aug 09 '22 14:08 NoahvdAa

Cancel the AsyncPlayerChatEvent event and attempt to send a message.

Maybe you have to send a message in the event listener? Idk that's how I read it

olijeffers0n avatar Aug 09 '22 15:08 olijeffers0n

Please provider proper reproduction steps here. As Noah stated, this does not seem to be the case on a normal setup. Technically I'd close this at this point, however with how fresh the signed message support is, I'd be happier if you could give us more information on this, preferably a proper reproduction code snippet.

lynxplay avatar Aug 09 '22 15:08 lynxplay

I'm running into this same issue. Getting reports from players that shopping for items and specifying a number they wish to purchase in chat is causing kicks with the same Chat message validation failure message. Using the QuickShop plugin which does use AsyncPlayerChatEvent to cancel chat messages.

https://github.com/PotatoCraft-Studio/QuickShop-Reremake/blob/master/src/main/java/org/maxgamer/quickshop/listener/ChatListener.java#L39-L52

This also occurs with WorldGuard if the region is flagged to block player chat. Whenever someone is in the region flagged send-chat: DENY and tries to chat, everyone gets kicked but the person who had their message cancelled.

https://github.com/EngineHub/WorldGuard/blob/0165175a2ebda5985d0f8cab273cad2b65777ead/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java#L139-L168

In both cases, it doesn't kick the person doing the action but does end up kicking everyone else. So for testing, you would need two clients.

mibby avatar Aug 10 '22 06:08 mibby

I am having the same issue image

Here is more info:

image

andy01745 avatar Aug 10 '22 06:08 andy01745

Fixed it based on the limited information provided; if this still happens, please open a new issue with a full list of plugins, and if it's a private one, we still need the actual code of the chat listeners. Ideally in form of minimal reproduction steps with just one plugin that causes it

kennytv avatar Aug 10 '22 08:08 kennytv

Thank you. I figured out that it is to do with one of these. image

After updating them all the issue has been fixed and also whatever you changed. @kennytv

andy01745 avatar Aug 10 '22 09:08 andy01745

Just commenting to say this has definitely fixed an ongoing issue I've had and been unable to pin down. Fantastic job on the fix thank you so much.

james090500 avatar Aug 11 '22 22:08 james090500

@kennytv https://github.com/PaperMC/Paper/commit/954b3fb7d5215acba1c736ba88174a9de3642ce4 This doesn't seem to fix the issue for me with the QuickShop plugin. Players entering a number in chat when shopping and having the message cancelled still end up kicking everyone but the person who entered the message.

Same with WorldGuard region with chat blocked, except it doesn't kick everyone, only some people.

mibby avatar Aug 12 '22 18:08 mibby

@kennytv This doesn't seem to fix the issue for me with the QuickShop plugin. Players entering a number in chat when shopping and having the message cancelled still end up kicking everyone but the person who entered the message.

Same with WorldGuard region with chat blocked, except it doesn't kick everyone, only some people.

me too waterfall-1.19-500 paper-1.19.2-125

edit: chat format plugin multichat-1.9.7

tygh89071388 avatar Aug 12 '22 20:08 tygh89071388

Y'all make sure to be on latest TAB, they had bug kicking players. I couldn't reproduce it with essentials, essentials chat, antipopup and tab (Under velocity proxy)

KaspianDev avatar Aug 12 '22 22:08 KaspianDev

Y'all make sure to be on latest TAB

I was able to reproduce this with TAB disabled, as well as latest source commit in my environment. I'm in the process of cloning everything for testing to see if I can reproduce locally or find if there is a conflict somewhere.

mibby avatar Aug 12 '22 22:08 mibby

After diving deep into narrowing down the problem, this seems to have everything to do with using AntiPopup when connecting behind a proxy.

Waterfall dev 500 Plugins; None

config.yml

enforce_secure_profile: false
online_mode: true

Paper dev 125 (1.19.2) Plugins; EssentialsX 2.20.0 dev 1409 https://ci.ender.zone/view/All/job/EssentialsX WorldEdit dev 6244 WorldGuard dev 2204 https://builds.enginehub.org/ Vault dev 23 https://ci.codemc.io/view/All/job/ThirdParty/job/Vault/ Multiverse-Core dev 870 http://ci.onarandombox.com/job/Multiverse-Core/ QuickShop 5.1.0.9 https://www.spigotmc.org/resources/quickshop-reremake-1-19-ready-multi-currency.62575/ AntiPopup (latest commit - https://github.com/KaspianDev/AntiPopup/commit/81091603cf7dbaa921b9bafdabbf0c495bda12b3) https://github.com/KaspianDev/AntiPopup/actions/runs/2817682753

server.properties

enforce-secure-profile=false
online-mode=false

spigot.yml

bungeecord: true
  • Login through Waterfall -> Paper server
  • Try chatting in a region flagged send-chat: DENY.
  • Chat message validation failure kicks happen.

Alternatively;

  • Login through Waterfall -> Paper server
  • Try purchasing from a chest shop that requires you to specify how many items you wish to buy in chat
  • Chat message validation failure kicks happen.

When removing AntiPopup from the server, very oddly for some reason, you are required to restart the server twice to clear whatever it did to block messages. This is probably why removing it is causing some confusion when testing and the kicks still happens.

  • Stop Server
  • Remove / disable AntiPopup from Paper plugins folder
  • Start Server
  • Login Waterfall -> Paper
  • Kicks still happen if chatting in disabled region
  • Stop Server
  • Start Server
  • Login Waterfall -> Paper
  • Kicks no longer happen.

Similarly, if you do not use a proxy to login and have standard online mode / no bungeecord forwarding settings in the Paper environment, you can use AntiPopup on the server to disable the tooltip warning for non secure chat perfectly fine. (For if supporting older versions.) It does not cause the kicking when chat is cancelled by plugins.

The kicking issues are entirely related to using AntiPopup on a Paper server behind a Proxy. Hope this helps narrow down the problem if it's a plugin issue or something possibly going on with the proxy.


ChatControl-Red causing kicks whenever someone chats now is from the same issue and only when connecting behind a proxy while using AntiPopup.

mibby avatar Aug 13 '22 00:08 mibby

I'll investigate it further with waterfall, please move all messages related to antipopup to my discord server or GitHub issues

KaspianDev avatar Aug 13 '22 10:08 KaspianDev