Minecraft Data Packs / Server Utility

Color names & AFK display

  • check_circle Advancements
  • check_circle Functions
  • 10,281 views, 8 today
  • 919 downloads, 2 today
  • 10
  • 7
Breakmit avatar Breakmit
Level 48 : Master Goblin
Colors & AFK

This datapack for servers allows to let your players choose a name color and have an afk display system at the same time, all without plugins. This works using teams so it might not be compatible with some datapacks and will definitely not be with datapacks that add suffixes, prefixes, change collision rules or do anything with teams.


after placing the pack in your datapack folder, unzip and go to the file data/caa/functions/admin_config.mcfunction

afk delay = the delay, in seconds, before a player goes afk when he stops moving

player can use color = at 1, anyone can change his color, at 0, only the players specified can change their color or others players color with /scoreboard players set [​player] [​color.<color>] 1 (requires op).

canColor permissions = if playersColor=0, this allows you to specify who can change color.
The part you can modify is "unless entity @s[ ]", this is a condition, you can add more after it like that:
execute as @a unless entity @[ ] if entity @s[ ] run tag @s add caa.canColor
the conditions can start with if or unless, any player that matches every condition cannot change color, you can then change the arguments between brackets (if all conditions in the bracket are matched, the condition is matched), you can have more details on selector arguments HERE. If you want an OR type condition, copy-paste the whole command with new conditions, any players who pass at least 1 will have permissions.

a few useful arguments:
with "if" condition:
  [name=<name>], only player who are called <name> passes, only use once per command,
  [name=!<name>], only player who are not called >name> can pass, can be used multiple times
  [x=<n>, y=<n>, z=<n>, distance=..<n>] only players within distance blocks of x y z pass

you can now zip it again (you can also leave the datapack folder) if you want to and go into the game and type reload the world.

go in the advancement tab, there should be an advancements for the pack


to set your color, use
/trigger color.[​color]getting color can take up to 10 seconds as this is the update rate, dont spam!

afk display only works if the person has a color (white can be used for no color)


tick (20/s): 0 functions
  -every 10s: up to 41+16*(nbPlayers)+16*(canColor players) commands, 0 nbt access, 0 @e, 2 @a
  -every 01s: up to 12+16*(nbPlayers) (if all players go afk at the same time, will be 12 most times), 6*(nbPlayers) nbt access, 0 @e 12 @a
CompatibilityMinecraft 1.13
toMinecraft 1.15

Create an account or sign in to comment.

Planet Minecraft


© 2010 - 2022