
AFK Sleep
Sleep while players are idle on your server · Works with custom player sleeping percentages · Handles dimensions, leaving, joining, ...
Screenshots

About this Mod
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.
Available Versions
How to Install AFK Sleep on Your Server
Order Server
Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).
Set datapack Loader
In the panel under "Egg", select the datapack loader and matching Minecraft version (1.21.8).
Install Mod
Open the mod browser in the dashboard and search for "AFK Sleep". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.
Compatibility
Mod Loaders
Minecraft Versions
1.21.8, 1.21.7, 1.21.6 (+23 more)
Server-side
✓ RequiredRecommended RAM
4 GB(min. 3 GB)Frequently Asked Questions
AFK Sleep server crashes on startup – what to do?
Most common cause: wrong datapack version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21.8). You can switch loaders with one click in the panel.
Is AFK Sleep compatible with datapack and fabric and forge and neoforge and quilt?
AFK Sleep officially supports datapack, fabric, forge, neoforge, quilt for Minecraft 1.21.8, 1.21.7, 1.21.6. Note: Forge and Fabric mods are NOT cross-compatible – pick one loader and stick with it. The Mado dashboard automatically detects incompatible loader combinations.
Server lagging with AFK Sleep – how to optimize performance?
Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if AFK Sleep consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.
Similar Mods
Rent Modded Server
Install AFK Sleep with just one click on your server.