SleepPlugin
适用于 Minecraft 1.21.x 和 26.x 的增强型睡眠机制。无需所有玩家都睡觉,只需一定比例(可配置)的在线玩家入睡即可跳过夜晚。兼容 Paper、Purpur、Spigot 及兼容服务器。
功能特性
- 可配置的睡眠百分比 — 默认需要 50% 的在线玩家入睡,支持按世界单独配置
- 带权重的睡眠投票,支持 LuckyPerms(可选,自动检测)
- 显示实时睡眠进度的 Bossbar(标题栏)
- 防止幻翼生成(
spawn_phantoms 游戏内规则)
- 跳过暴风雨和夜晚
- 从夜晚到清晨平滑的时间过渡
- 多种消息模式(正常、最小化、静默)
- 忽略处于下界(Nether)和末地(End)维度的玩家
- 针对奇数玩家数量的智能计数逻辑
- 多世界支持,支持按世界覆盖设置
- 多语言支持(英语、俄语及自定义语言)
- 配置更新系统,可在更新插件时保留您的设置
- 管理员命令
/sleep reload|status
依赖要求
- Minecraft:1.21.x 或 26.x
- 服务端:Paper、Purpur、Spigot(或兼容服务端)
- Java:21+(适用于 1.21.x)/ 25+(适用于 26.x)
安装方法
- 下载
SleepPlugin-1.0.4.jar
- 将其放入服务器的
plugins/ 文件夹中
- 重启服务器
示例
在默认 sleep-percentage: 50 设置下:
- 2 名玩家在线:1 名玩家需要入睡
- 3 名玩家在线:1 名玩家需要入睡 ((3-1)/2 = 1)
- 4 名玩家在线:2 名玩家需要入睡
- 5 名玩家在线:2 名玩家需要入睡 ((5-1)/2 = 2)
- 6 名玩家在线:3 名玩家需要入睡
在 sleep-percentage: 25 设置下:
- 4 名玩家在线:1 名玩家需要入睡
- 8 名玩家在线:2 名玩家需要入睡
- 20 名玩家在线:5 名玩家需要入睡
配置说明
配置文件将在首次启动时创建於 plugins/SleepPlugin/config.yml:
# SleepPlugin Configuration
# Do not change this version number manually
version: "1.0.4"
language: en_EN
skip-delay: 3
morning-time: 1000
message-mode: normal
min-players-required: 2
ignore-nether-end-players: true
sleep-percentage: 50
prevent-phantoms: true
bossbar:
enabled: true
color: YELLOW
style: SOLID
title: "Sleeping %s/%s"
smooth-time-transition:
enabled: true
duration-ticks: 60
steps: 60
storm-settings:
skip-storms: true
# world-settings:
# world:
# sleep-percentage: 50
# min-players-required: 2
设置项说明
language: 插件消息语言(en_EN 或 ru_RU,或任何自定义代码)
skip-delay: 跳过夜晚前的延迟秒数
morning-time: 跳到清晨时设定的时间值
message-mode: 消息详细程度(normal, minimal, silent)
min-players-required: 激活睡眠机制所需的最少玩家数量
ignore-nether-end-players: 在计算中排除处于下界/末地的玩家
sleep-percentage: 必须入睡的在线玩家百分比(1-100,默认 50)。始终至少需要 1 名玩家
prevent-phantoms: 在插件启用期间禁用幻翼生成
bossbar:
enabled: 显示睡眠进度 Bossbar
color: PINK, BLUE, RED, GREEN, YELLOW, PURPLE, WHITE
style: SOLID, SEGMENTED_6, SEGMENTED_10, SEGMENTED_12, SEGMENTED_20
title: Bossbar 标题 (%s = 当前入睡人数 / 所需人数)
smooth-time-transition: 平滑时间变化设置 (enabled, duration-ticks, steps)
storm-settings: 暴风雨跳过设置 (skip-storms)
world-settings: 按世界覆盖设置。添加一个以世界命名的部分,仅对该世界的 sleep-percentage 和 min-players-required 进行覆盖
命令
/sleep status — 显示百分比和按世界划分的设置(权限:sleepplugin.admin)
/sleep reload — 重新加载配置文件和语言文件(权限:sleepplugin.admin)
LuckyPerms 集成
SleepPlugin 可选地与 LuckyPerms 作为软依赖集成。如果没有安装 LuckyPerms,插件行为与之前完全一致(每个玩家计为 1 票)。安装 LuckyPerms 后会自动检测。
加权睡眠投票 — 设置 sleepplugin.weight 元数据,使某玩家的睡眠计为多票:
/lp group vip meta set sleepplugin.weight 2
权重为 2 的 VIP 玩家相当于 2 名入睡玩家,因此需要更少的捐赠者即可跳过夜晚。权重限制在 1-100 之间,并支持 LuckyPerms 上下文(例如按世界/服务器区分):
/lp group vip meta set sleepplugin.weight 2 server=survival
权限节点:
sleepplugin.exempt — 该玩家不计入睡眠计算(例如处于创造/旁观模式的管理员)。默认:false。
sleepplugin.bypass.min-players — 即使低于 min-players-required 或单独一人时,入睡的玩家也能跳过夜晚。默认:false。
sleepplugin.admin — 访问 /sleep 命令。默认:op。
注意: sleepplugin.exempt 和 sleepplugin.bypass.min-players 是普通的 Bukkit 权限节点 — 它们适用于任何权限插件。
自定义语言文件
您可以创建自己的翻译:
- 进入
plugins/SleepPlugin/lang/ 目录
- 复制
template.yml(首次启动时创建)或 en_EN.yml/ru_RU.yml
- 将其重命名为您的语言代码(例如
de_DE.yml、fr_FR.yml、es_ES.yml)
- 翻译所有消息字符串
- 在
config.yml 中设置 language: de_DE
- 重启服务器
插件会自动检测所有自定义语言文件!请使用 template.yml — 它包含对翻译者有帮助的注释。
SleepPlugin
Enhanced sleep mechanics for Minecraft 1.21.x and 26.x. Instead of everyone having to sleep, only a configurable percentage of online players is needed to skip the night. Works on Paper, Purpur, Spigot and compatible servers.
Features
- Configurable sleep percentage — default 50% of online players, configurable per world
- Weighted sleep votes with LuckyPerms (optional, auto-detected)
- Bossbar showing live sleep progress
- Phantom prevention (
spawn_phantoms game rule)
- Storm and night skipping
- Smooth time transition from night to morning
- Multiple message modes (normal, minimal, silent)
- Ignore players in Nether and End dimensions
- Smart counting for odd player counts
- Multi-world support with per-world overrides
- Multi-language support (English, Russian, and custom languages)
- Configuration update system that preserves your settings across updates
- Admin command
/sleep reload|status
Requirements
- Minecraft: 1.21.x or 26.x
- Server: Paper, Purpur, Spigot (or compatible)
- Java: 21+ (1.21.x) / 25+ (26.x)
Installation
- Download
SleepPlugin-1.0.4.jar
- Place it in your server's
plugins/ folder
- Restart the server
Examples
With default sleep-percentage: 50:
- 2 players online: 1 player needs to sleep
- 3 players online: 1 player needs to sleep ((3-1)/2 = 1)
- 4 players online: 2 players need to sleep
- 5 players online: 2 players need to sleep ((5-1)/2 = 2)
- 6 players online: 3 players need to sleep
With sleep-percentage: 25:
- 4 players online: 1 player needs to sleep
- 8 players online: 2 players need to sleep
- 20 players online: 5 players need to sleep
Configuration
The config file is created at plugins/SleepPlugin/config.yml on first start:
# SleepPlugin Configuration
# Do not change this version number manually
version: "1.0.4"
language: en_EN
skip-delay: 3
morning-time: 1000
message-mode: normal
min-players-required: 2
ignore-nether-end-players: true
sleep-percentage: 50
prevent-phantoms: true
bossbar:
enabled: true
color: YELLOW
style: SOLID
title: "Sleeping %s/%s"
smooth-time-transition:
enabled: true
duration-ticks: 60
steps: 60
storm-settings:
skip-storms: true
# world-settings:
# world:
# sleep-percentage: 50
# min-players-required: 2
Settings
language: Plugin message language (en_EN or ru_RU, or any custom code)
skip-delay: Seconds before the night is skipped
morning-time: Time value set when skipping to morning
message-mode: Message verbosity (normal, minimal, silent)
min-players-required: Minimum players needed to activate sleep mechanics
ignore-nether-end-players: Exclude Nether/End players from calculations
sleep-percentage: Percentage of online players that must sleep (1-100, default 50). At least 1 player is always required
prevent-phantoms: Disables phantom spawning while the plugin is active
bossbar:
enabled: Show the sleep progress bossbar
color: PINK, BLUE, RED, GREEN, YELLOW, PURPLE, WHITE
style: SOLID, SEGMENTED_6, SEGMENTED_10, SEGMENTED_12, SEGMENTED_20
title: Bossbar title (%s = sleeping count / required count)
smooth-time-transition: Smooth time change settings (enabled, duration-ticks, steps)
storm-settings: Storm skipping (skip-storms)
world-settings: Per-world overrides. Add a section named after a world to override sleep-percentage and min-players-required for that world only
Command
/sleep status — show percentage and per-world settings (permission: sleepplugin.admin)
/sleep reload — reload config and language files (permission: sleepplugin.admin)
LuckyPerms Integration
SleepPlugin optionally integrates with LuckyPerms as a soft-dependency. Without it, the plugin behaves exactly as before (every player counts as 1). Install LuckyPerms and it is detected automatically.
Weighted sleep votes — set the sleepplugin.weight meta so a player's sleep counts as multiple votes:
/lp group vip meta set sleepplugin.weight 2
A VIP with weight 2 counts as 2 sleeping players, so fewer donors are needed to skip the night. Weight is clamped to 1-100 and supports LuckyPerms contexts (e.g. per world/server):
/lp group vip meta set sleepplugin.weight 2 server=survival
Permissions:
sleepplugin.exempt — player is not counted for sleep calculations (e.g. admins in creative/spectator). Default: false.
sleepplugin.bypass.min-players — sleeping player skips the night even below min-players-required or when alone. Default: false.
sleepplugin.admin — access to /sleep command. Default: op.
Note: sleepplugin.exempt and sleepplugin.bypass.min-players are plain Bukkit permissions — they work with any permissions plugin.
Custom Language Files
You can create your own translations:
- Navigate to
plugins/SleepPlugin/lang/
- Copy
template.yml (created on first start) or en_EN.yml/ru_RU.yml
- Rename it to your language code (e.g.,
de_DE.yml, fr_FR.yml, es_ES.yml)
- Translate all message strings
- Set
language: de_DE in config.yml
- Restart the server
The plugin automatically detects all custom language files! Use template.yml — it has helpful comments for translators.
评论 0
登录后参与评分
还没有评论,来抢沙发吧