AFK Sleep
允许玩家在服务器上有挂机玩家时也能睡觉,并尊重你原有的 playersSleepingPercentage 设置。如果有玩家加入后立刻离开去洗澡,现在这不会阻止你跳过夜晚。
功能
- 可配置的百分比 - 像平常一样修改该游戏内规则
- 高度优化 - 除非必要否则不运行命令,不使用 NBT 数据,不进行每刻检查
- 响应变化 - 离开、加入、改变挂机状态、改变维度等
- 正确工作 - 其他数据包不考虑维度或状态变化

详情
当首次安装 AFK Sleep 时,它会使用你设置的 playersSleepingPercentage 作为主世界中非挂机玩家必须睡觉才能跳过夜晚的百分比。下表解释了这一点:
| 玩家数 | 非挂机数 | playersSleepingPercentage | 需要睡觉的玩家数 |
|---|---|---|---|
| 3 | 3 | 100% | 3(所有三个玩家都必须睡觉) |
| 3 | 2 | 100% | 2(只有两个非挂机的玩家需要睡觉) |
| 3 | 2 | 50% | 1(只有半数的非挂机玩家需要睡觉) |
要更改需要睡觉的“活跃”玩家百分比,只需像平常那样通过 /gamerule playersSleepingPercentage NUMBER 修改该游戏内规则即可。此游戏内规则由数据包自动管理,因此如果其值不符合你的预期也不必担心。
1.3 版本之前:如何更改 playersSleepingPercentage
由于此数据包覆盖了 playersSleepingPercentage 游戏内规则,你必须修改记分板数值来改变其计算方式。将数字 '50' 替换为你想要设置的百分比。
/scoreboard players set .relativePercentage afk_sleep.dummy 50
如果你想卸载此数据包,请运行 /function afk_sleep:uninstall 以删除后台记分板并自动重置 playersSleepingPercentage。
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.
下载 AFK Sleep
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 AFK Sleep
下载 AFK Sleep
下载 AFK Sleep
下载 AFK Sleep
下载 AFK Sleep
下载 AFK Sleep
下载 AFK Sleep
此版本不再支持 1.21 之前的游戏版本,这将为任何未来功能提供一个良好的基线。我目前没有计划引入任何新功能。
此版本还移除了我遗留的调试日志。如果您没有特定的标签,它们不会执行任何操作,但仍会增加非常、非常小的开销。因此,我想发布一个不包含这些日志的新版本。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
数据包
此数据包添加了属于阿瓦里海盗的独特结构,将他们的独特风格带入你的 Minecraft 世界!兼容性:1.20 至 26.3
数据包
一个 Minecraft 光线投射库,能够精确检测玩家正在查看的方块,包括像台阶和楼梯这样的特殊方块形状。
数据包
此数据包添加了新的“祝福模式”难度。
数据包
允许服务器管理员方便地禁用 Xaero's Map 系列模组中的实体雷达、小地图等功能,使竞技游戏更加公平。
数据包
使用原版/生存友好的方法更改青蛙的变种类型。支持原版(寒冷、温带、温暖)以及可选的“More Frogs 2”变种:深红、末影、地狱、毒镖、紫珀、幽匿、灵魂、诡异和木头。
数据包
手持潜影盒时可直接打开,无需将其放置在地面上。只需按住 Shift 并右键点击即可访问你的潜影盒。
评论 0
登录后参与评分
还没有评论,来抢沙发吧