COWMODSКаталог модов

AFK Sleep

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

Автор: clo410,4 тыс.31обновлён 30 мар. 2025 г.
Механики игрыОбщениеУтилиты

Описание

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

https://cdn.modrinth.com/data/hBJVFBHF/images/a555a85ba89158b0d992c7151b6d811a21493f16.jpeg

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:

PlayersNot AFKplayersSleepingPercentagePlayers required to sleep
33100%3 (all three players have to sleep)
32100%2 (only the two non-afk players have to sleep)
3250%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.

Галерея

A player sleeps while another player idles next to the bed

Последние версии

Все версии →
release

Version 1.3.2

1.3.2+mod
30 мар. 2025 г.8,6 тыс.Minecraft: 1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8fabric, forge, neoforge, quilt
Скачать
Что нового
This version drops support for game versions before 1.21, which will give me a good baseline for any future features. I don't plan on introducing anything new any time soon. This version also removes the debug logs that I left in. They don't do anything if you don't have a particular tag, but still add a very, *very* small amount of overhead. So I wanted to get a new release out for myself that doesn't contain them.
release

Version 1.3.2

1.3.2
23 дек. 2024 г.607Minecraft: 1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8datapack
Скачать
Что нового
This version drops support for game versions before 1.21, which will give me a good baseline for any future features. I don't plan on introducing anything new any time soon. This version also removes the debug logs that I left in. They don't do anything if you don't have a particular tag, but still add a very, *very* small amount of overhead. So I wanted to get a new release out for myself that doesn't contain them.
release

Version 1.3.1

1.3.1
11 нояб. 2024 г.117Minecraft: 1.20.3, 1.20.4, 1.20.5, 1.20.6, 1.21, 1.21.1, 1.21.2, 1.21.3datapack
Скачать
Что нового
This is a patch release for 1.3 that drops support for older versions of the game. Both releases behave the same. To recap the changes in 1.3: - Players in other dimensions are no longer counted toward the total number of players - Changing player conditions will now update the `playersSleepingPercentage` while players are trying to sleep - This means a player leaving and rejoining, or travelling to the nether, will now work correctly! - The "relative percentage" (percentage of online, non-AFK players in the same dimension) that have to sleep to pass the night can now be updated directly by changing the `playersSleepingPercentage` gamerule - I kept having to check my own documentation to remember what value had to change. This massively simplifies the experience and removes a big source of surprise.
release

Version 1.3

1.3
11 нояб. 2024 г.504Minecraft: 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6, 1.21, 1.21.1, 1.21.2, 1.21.3datapack
Скачать
Что нового
This version is a massive internal refactor. ## Fixes - Players in other dimensions are no longer counted toward the total number of players - Changing player conditions will now update the `playersSleepingPercentage` while players are trying to sleep - This means a player leaving and rejoining, or travelling to the nether, will now work correctly! - The "relative percentage" (percentage of online, non-AFK players in the same dimension) that have to sleep to pass the night can now be updated directly by changing the `playersSleepingPercentage` gamerule - I kept having to check my own documentation to remember what value had to change. This massively simplifies the experience and removes a big source of surprise.
release

Version 1.2.1

1.2.1
17 июн. 2024 г.294Minecraft: 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6, 1.21, 1.21.1, 1.21.2, 1.21.3datapack
Скачать
Что нового
Updated to include support for 1.21.0
release

v1.2 for 1.17 to 1.20.1

1.2
12 мар. 2024 г.135Minecraft: 1.17, 1.17.1, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1datapack
Скачать
Что нового
Backported the datapack to 1.17, which is the first version of Minecraft that has the `playersSleepingPercentage` gamerule. This version of the pack is *tecnically* compatible later versions as well, but it's not as fast because function macros simplify the logic a *lot*. [Code for this version is on the `afk-sleep-no-macros` branch.](https://github.com/clo4/datapacks/tree/afk-sleep-no-macros/afk-sleep)
release

v1.2 for 1.20.2-1.20.4

1.2
28 февр. 2024 г.83Minecraft: 1.20.2, 1.20.3, 1.20.4datapack
Скачать
Что нового
- Added pack.png Thankfully not many people have downloaded this so I don't feel bad doing a release for something so small :p
release

v1.1 for 1.20.2+

1.1
26 февр. 2024 г.62Minecraft: 1.20.2, 1.20.3, 1.20.4datapack
Скачать
Что нового
First public release! 1.1 includes some improvements found in testing.