EssentialsX

EssentialsX

2M Downloads

AFK status change occurs after chat message - a change from old Essentials logic.

mibby opened this issue ยท 1 comments

commented

Type of bug

Other unexpected behaviour

/ess version output

[18:48:06] [Server thread/INFO]: Server version: 1.16.5-R0.1-SNAPSHOT git-Paper-468 (MC: 1.16.5)
[18:48:06] [Server thread/INFO]: EssentialsX version: 2.19.0-dev+69-adef08a
[18:48:06] [Server thread/INFO]: PlaceholderAPI version: 2.10.10-DEV-122
[18:48:06] [Server thread/INFO]: LuckPerms version: 5.2.106
[18:48:06] [Server thread/INFO]: Vault version: 1.7.3-b${env.TRAVIS_BUILD_NUMBER}
[18:48:06] [Server thread/INFO]: EssentialsXAntiBuild version: 2.19.0-dev+69-adef08a
[18:48:06] [Server thread/INFO]: EssentialsXSpawn version: 2.19.0-dev+69-adef08a
[18:48:06] [Server thread/INFO]: Citizens version: 2.0.27-SNAPSHOT (build 2264)

Server startup log

Unrelated.

EssentialsX config files

https://paste.gg/p/anonymous/2fc013729ee348f2b5af6fcf6b1f8332/files/3740581da091432cad8d0ec922fc9107/raw

Error log (if applicable)

Unrelated.

Bug description

PR #3863 seems to make the AFK status change / message occur after a chat message is sent. Is there any possibility of moving this logic around so players go unafk first, followed by their message afterwards to match older Essentials behavior? Primarily to prevent someone returning from being AFK and immediately having their chat line thrown behind their afk status change one.

Here's a screenshot I found showing the old logic.
link

Here is how it currently now behaves.
link2

Using ChatControl Red for reference (formerly ChatControl Pro v8).

Steps to reproduce

  1. Go afk.
  2. Chat to unafk.
  3. See afk status change message occur after chat message.

Expected behaviour

Old Essentials logic / behavior - AFK change before message.

Actual behaviour

AFK change after message.

commented

The problem here was that the afk check on chat was doing so on the chat thread (off-main). This was kinda unsafe as we do call some Bukkit API in that method (which isn't thread safe!). The PR you reference, schedules that check on the main thread. And thus, will happen on the next tick, causing the message to appear after the chat message. The way around this would be a giant hack for a pure cosmetic change, so this will probably not be done in EssX 2.x