This version changes how the away/back logic works to remove the need for a permanently-running loop. The loop only runs while there are players tagged as afk. The data pack is now much lazier!
This version changes how the away/back logic works to remove the need for a permanently-running loop. The loop only runs while there are players tagged as afk. The data pack is now much lazier!
afk team, fixing players that left while AFK re-joining and showing the afk team color and prefix/suffix in chat.afk team, fixing players that left while AFK re-joining and showing the afk team color and prefix/suffix in chat.This update is a small but significant change: when players are already in a team, it will not put them in the afk team. When players are not in the afk team when returning, they will not be removed from their team.
The behavior <1.1 would naively override the team, and then leave whatever team the player was in regardless of if it had changed when the player returned.
I believe this new behavior is an improvement, but if it causes issues for you, please open an issue on GitHub and I'll look into it ASAP. However, this should be a more reliable system over all.
Tested on 1.18 and 1.21

Dim player names when they go AFK. Shows above their heads and in the server list.