AFK Sleep
No reviews yet
Sleep while players are idle on your server · Works with custom player sleeping percentages · Handles dimensions, leaving, joining, ...
Data Packs were introduced to vanilla Minecraft in version 1.13 and allow the server to modify data about the game, or run commands. Data Packs are compatible with all mod loaders.
Forge is a popular mod loader for versions 1.1+ of Minecraft.
Neoforge is a fork of the Minecraft Forge available for versions 1.20.1+ of Minecraft. Many Forge mods are compatible with Neoforge and vice versa.
Fabric is a mod loader for versions 1.14+ of Minecraft, particularly popular for client side and optimization mods.
Quilt is a fork of the Fabric mod loader. Many Fabric mods are compatible with Quilt and vice versa.
Community voices
Reviews
Click once to include, again to exclude, again to clear
No reviews yet. Be the first to review this project!
Get it on
Available Platforms
Compatibility
Supported Environments
About
Project Details
For authors
Embed Badge
If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.
Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.
Identifiers
Platform IDs
About
Description
AFK Sleep
Requires Detect AFK Players.
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.
Features
- Configurable percentage - Change the gamerule like you would normally
- Highly optimized - No commands run unless necessary, no NBT usage, no checks every tick
- Reacts to changes - Leaving, joining, changing AFK state, changing dimension, etc
- Works correctly - Other data packs don't consider dimensions or state changes

Details
When AFK Sleep is first installed, it uses the playersSleepingPercentage you've set as the percentage of non-AFK players in the overworld 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) |
To change the percentage of "active" players that need to sleep, just change the gamerule like you normally would, with /gamerule playersSleepingPercentage NUMBER. This gamerule is managed for you, so don't worry if it isn't set to the value you expect.
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.
Versions
Files
Relations
Project Relations
More like this
Similar Mods
Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.
On ModDex
Community snapshot
By the numbers
Statistics
Want to reach Minecraft players?
We're looking for a server hosting partner to feature here and other parts of the site. Interested? Send us a message!
Get in touchGet it on
Available Platforms
On ModDex
Community snapshot
By the numbers