Sleep notify
From Zedwiki
Revision as of 02:28, 4 August 2018 by Zedwick (Talk | contribs) (Created page with "Shows how many players are currently sleeping == Download == == Files == === sleep_notify/pack.mcmeta === <pre> { "pack": { "pack_format": 1, "descrip...")
Shows how many players are currently sleeping
Contents
- 1 Download
- 2 Files
- 2.1 sleep_notify/pack.mcmeta
- 2.2 sleep_notify/data/minecraft/tags/functions/load.json
- 2.3 sleep_notify/data/minecraft/tags/functions/tick.json
- 2.4 sleep_notify/data/sleep_notify/functions/root.mcfunction
- 2.5 sleep_notify/data/sleep_notify/functions/notify.mcfunction
- 2.6 sleep_notify/data/sleep_notify/functions/setup.mcfunction
Download
Files
sleep_notify/pack.mcmeta
{ "pack": { "pack_format": 1, "description": "Shows how many players are currently sleeping" } }
sleep_notify/data/minecraft/tags/functions/load.json
Specifies the setup mcfunction to be ran on server load (or reload)
{ "replace": "false", "values": [ "sleep_notify:setup" ] }
sleep_notify/data/minecraft/tags/functions/tick.json
Specifies the root mcfunction to be ran every tick
{ "replace": "false", "values": [ "sleep_notify:root" ] }
sleep_notify/data/sleep_notify/functions/root.mcfunction
The root mcfunction, this is ran every tick (as specified in the tick.json file).
#function sleep_notify/root execute if entity @a[nbt={Sleeping:1b}] run function sleep_notify:notify
sleep_notify/data/sleep_notify/functions/notify.mcfunction
The notify mcfunction is only ran if one or more players are currently sleeping.
#function sleep_notify/notify scoreboard players reset * sleep_notify execute as @a run scoreboard players add online sleep_notify 1 execute as @a[nbt={Sleeping:1b}] run scoreboard players add sleeping sleep_notify 1 title @a actionbar {"text":"","extra":[{"score":{"name":"sleeping","objective":"sleep_notify"},"color":"aqua"},{"text":"/","color":"gray"},{"score":{"name":"online","objective":"sleep_notify"},"color":"dark_aqua"},{"text":" players are sleeping","color":"gray"}]}
sleep_notify/data/sleep_notify/functions/setup.mcfunction
The setup mcfunction adds the scoreboard objective required for tracking sleeping players. This is ran on server start and reload, as specified in load.json.
#function sleep_notify/setup scoreboard objectives add sleep_notify dummy