AFK Sleep
An add-on for Detect AFK Players (required).
Allows players to sleep even when there are players AFK on the server, and respects your original playersSleepingPercentage
. If you've got someone that joins then immediately leaves to take a shower, now that won't stop you from being able to skip the night.
This datapack relies on Detect AFK Players - you must have this datapack installed, but the order is not important.
It's designed to be lightweight and performant: it runs very few commands, and only when necessary.
Details
When AFK Sleep is first installed, it uses the playersSleepingPercentage
you've set as the percentage of non-afk players that have to be sleeping to skip the night. The table below explains it:
Players | Not AFK | playersSleepingPercentage | Players required to sleep |
---|---|---|---|
3 | 3 | 100% | 3 (all three players have to sleep) |
3 | 2 | 100% | 2 (only the two non-afk players have to sleep) |
3 | 2 | 50% | 1 (only half of the non-afk players have to sleep) |
Remember, Minecraft rounds the percentage required to sleep up to the nearest number of players. This probably won't be a problem for you, but it's worth noting!
To change the percentage of "active" players that need to sleep, just change the gamerule like you normally would, with /gamerule playersSleepingPercentage NUMBER
.
Before version 1.3: How to change playersSleepingPercentage
Because this datapack overrides the playersSleepingPercentage
gamerule, you have to modify a scoreboard value to change its calculations. Replace the number '50' with the percentage you want to set.
/scoreboard players set .relativePercentage afk_sleep.dummy 50
If you want to uninstall the datapack, run /function afk_sleep:uninstall
to delete the backing scoreboards and reset the playersSleepingPercentage
automatically.
90% of ad revenue goes to creators
Support creators and Modrinth ad-free with Modrinth+