EssentialsX / Essentials

The modern Essentials suite for Spigot and Paper.
https://essentialsx.net
GNU General Public License v3.0
1.96k stars 980 forks source link

Auto-AFK issue: AFK timer not reset on disconnect #1928

Closed takatalvi closed 5 years ago

takatalvi commented 6 years ago

Today I updated to the latest version of EssX and I noticed that cancel-afk-on-move and cancel-afk-on-interact now work separately, which is great and I already made use of it. However, as my players noticed, and based on what they reported to me, I think there could be two additional settings (working separately from the two above) - cancel-afk-on-chat (applies to global chat and to /msg or /r), and cancel-afk-on disconnect (because now players are able to join in afk status, which in some cases means quick auto-kick, when their counter for auto-afk-kick is filled shortly after joining.

mdcfe commented 6 years ago

Players' AFK timers shouldn't be stored when they log off - that's an oversight on our part.

I'm not entirely sure whether having a separate cancel-afk-on-chat is necessarily particularly useful - if we added it, we'd need to then change cancel-afk-on-interact's behaviour to not overlap with that option, and that would break existing behaviour in Essentials that has existed for years.

takatalvi commented 6 years ago

Yes, that's what I was thinking. The counter should be reset on disconnect in any case, so I guess that is a bug. Regarding chat, I wanted to allow chat messages to reset the counter, but not right-click interactions. This could allow me to prevent people from afk-fishing, while not kicking people who just stand in the same spot and chat.

Dolphin2Point1 commented 6 years ago

I'll try making a pr for this.

takatalvi commented 6 years ago

Thanks, any update is appreciated :)

Dolphin2Point1 commented 6 years ago

I'm changing much more files than they did in the original pr.

NorbiPeti commented 6 years ago

When can we expect a fix to be released for kicking on login? Our players get kicked almost every time they join, so we had to disable the auto kick.

freeze-afk-players: false
disable-item-pickup-while-afk: true
cancel-afk-on-interact: false
cancel-afk-on-move: true

Using EssentialsX 2.15.0.16

takatalvi commented 5 years ago

I would like to bring up this issue again, but I don't want to create a duplicate: The issue persist, I understand that the root cause is that a player's AFK timer is not reset when disconnecting. This results in players logging in in AFK status, which doesn't make sense, and also, it subsequently means that the timer will pick up where it left - running past the autokick limit.

Please, add resetting on disconnect, that could solve the issue and shouldn't be too time-consuming to implement.

Ichbinjoe commented 5 years ago

For people having these problems, please try on the latest version to see if you still have the issue.

takatalvi commented 5 years ago

After basic testing, I can confirm the fix has worked, thank you so much! This will enable me to disable those pesky afk-fish farms and so on, thank you :)

mdcfe commented 5 years ago

Obligatory download message incoming...

This has now been fixed - you can download the latest version from the build server.