Bed Back Better
再也不用担心朋友弄坏你的床了!系统现在会记录你最后 5 个有效的出生点(数量可配置),这样即使你的床被破坏,你依然有一个(希望是)附近的床可以用作 fallback。
这是一个无需反复设置的、类原版的 Paper 插件,适用于 Minecraft 1.21.5+,允许你在床或重生锚损坏时回退到之前的床或重生锚。
已在 Paper 1.21.5 和 26.1.2 上测试通过。
灵感来源于 这篇 Reddit 帖子。
另见:
- (Neo)Forge 版本:
- Fabric 版本:
功能
- 保留出生点缓冲区! 死亡时,你将拥有一个更大的缓冲区(默认:最后 5 个有效出生位置)来防止因世界出生点问题而陷入困境——现在你拥有的不再是一个,而是五个(可配置)重生点!
- 自动回退,死亡无忧! 当前的床坏了?别担心!你会直接出生在上一张你睡过的床上!
- 跨维度重生! 如果主世界的床被破坏,你可以回退到下界的重生锚;反之亦然!
常见问题
-
我该如何使用它?
- 右键点击一张床。再右键点击另一张床,然后将其破坏。死亡后,你将在第一张床上重生!
-
它在不同维度间有效吗?
- 默认情况下,是的!如果你的床在主世界被破坏,你可以在下界通过重生锚重生,前提是它(1)已充能,(2)未被阻挡,并且(3)你的插件配置允许跨维度旅行!
-
如果我破坏一张床并在原地重新放置会发生什么?
- 该插件紧密遵循原版机制(只要 Minecraft Wiki 关于 床的逻辑 和 重生锚逻辑 的描述是正确的)。只要你用新床替换掉旧床头所在的精确方块位置,你应该就能回退到那张床作为重生点!
-
它是追踪“我最近睡过的 N 张有效床”还是“总共最近的 N 张床”(包括被破坏的)?
- 默认情况下,它是重生时最后 N 个有效的重生点。你可以在配置文件中将其更改为单纯的最近 N 个重生点。
-
服务器关闭后它还会继续追踪吗?
-
这个插件有多“原版风格”?
-
非常原版。出生点仅在重生时进行检查。如果重生时的出生点无效,它将从内存中删除(如同原版一样)。插件会继续丢弃记录,直到在重生时找到一个有效的出生点。
-
如果我永远不死会怎样?
-
你能提供低于 1.21.5 版本的支持吗?
-
如果你能告诉我 Paper 1.21.5 中新增的 isMissingRespawnBlock() 函数的替代方案,那就太好了。我不想为此编写变通代码。
配置选项
# 在寻找备用重生点时,考虑多少个之前的出生点。
fallback-candidates: 5
# 每个玩家最多存储的出生点数量。超出限制时将丢弃最旧的记录。
# 设置为 0 表示无限制。
max-stored-spawns: 100
# 备用时的行为策略:
# - LAST_N:仅考虑最近的 N 个出生点(包括无效点)
# - LAST_N_VALID:仅考虑最近的 N 个 *有效* 出生点
# - LAST_N_IN_DIMENSION:仅考虑该维度内最近的 N 个出生点(包括无效点)
# - LAST_N_VALID_IN_DIMENSION:仅考虑该维度内最近的 N 个 *有效* 出生点
# 注意:此策略会影响重生时可安全清理的记录范围,与 max-stored-spawns 无关。
# 例如,LAST_N_VALID 会丢弃所有记录,包括在第 N 个有效出生点之后找到的有效和无效记录。
fallback-policy: LAST_N_VALID
# 自动保存出生点记录的频率(以分钟为单位)。设置为 0 表示永不自动保存。
autosave-interval: 5
当玩家重生到新位置时显示的消息。设置为 "" 可省略消息。
fallback-respawn-message: "你的重生点已更新到新位置"
启用调试功能(在生成点更改、记录更改等时在服务器日志中输出)
debug-mode: false
## 命令用法
此插件不使用任何命令。
## 如何反馈插件存在问题?
请通过 [插件的 GitHub 仓库](https://github.com/ganyuke/BedBackBetter/) 上的 [问题追踪器](https://github.com/ganyuke/BedBackBetter/issues) 报告我这段“意大利面条式代码”存在的问题。
## 如何自行构建此插件?
1. 克隆此仓库:`git clone https://github.com/ganyuke/BedBackBetter.git`
2. 切换目录:`cd BedBackBetter`
3. 构建 `.jar` 文件:`./gradlew build`
4. 在 `build/libs/` 目录下找到构建好的 `.jar` 文件
## 如何为此插件提交功能建议?
如果你已经为其编写了代码,只要我觉得它不会使本插件的范围过于臃肿,我会欣然接受拉取请求(Pull Request)。请确保你使用了 [拉取请求模板](https://raw.githubusercontent.com/ganyuke/BedBackBetter/refs/heads/main/.github/pull_request_template.md)。
向此仓库提交贡献即表示你同意你的贡献按照本仓库发布的 [`LICENSE`](https://raw.githubusercontent.com/ganyuke/BedBackBetter/refs/heads/main/LICENSE) 文件中规定的相同许可证进行许可。
## 许可证
除非另有说明,本仓库中的所有源代码均在 **Mozilla Public License 2.0** (SPDX: **MPL-2.0**) 许可证下获得许可。有关 MPL-2.0 下的条款,请参阅 [`LICENSE`](https://raw.githubusercontent.com/ganyuke/BedBackBetter/refs/heads/main/LICENSE) 文件。
Bed Back Better
Never worry about your friend breaking your bed! Your last 5 valid spawn points (configurable) are now recorded so that, even if your bed breaks, you've always got a (hopefully) nearby bed to fallback to.
A set-it-and-forget-it, vanilla-ish Paper plugin for Minecraft 1.21.5+ that lets you fallback to previous beds and respawn anchors.
Tested to work on Paper 1.21.5 and 26.1.2.
Idea stolen from this Reddit post.
See also:
- For (Neo)Forge:
- For Fabric:
Features
- Keep a buffer of your spawns! On death, you have a much bigger buffer (default: last 5 valid spawn locations) against world spawn stranding - now you get not just one, but five (configurable) respawn points!
- Never fret on death with automatic fallback! Broke your current bed? Don't worry! You'll just spawn at the previous bed you slept at!
- Respawn across dimensions! If your bed breaks in the Overworld, you can fallback to a respawn anchor in the Nether and vice versa!
FAQ
- How do I use this?
- Right-click a bed. Right-click another bed, then break it. Die. Now you spawn at the first bed!
- Does it work across dimensions?
- By default, yes! If your bed breaks in the Overworld, you can respawn at a respawn anchor in the Nether, provided that it is (1) charged, (2) not obstructed, and (3) your plugin configuration allows cross-dimension travel!
- What happens if I break a bed and place it in the same place?
- The plugin follows vanilla mechanics closely (as long as the Minecraft Wiki was right for bed logic and respawn anchor logic!). As long as you replace the exact block where the former head of the bed was with the new bed, you should be able to fallback to that bed!
- Is it the 'last N valid beds that I slept in' or 'last N beds total' (including broken ones)?
- By default, it is the last N valid spawn points at the time of respawn. You can change it to be plain N spawn points in the config.
- Does it keep tracking after server shutdown?
- Duh, of course! It'd be pretty useless otherwise!
- How vanilla-ish is this plugin?
- Pretty vanilla. Spawn points are only considered at respawn time. If a spawn point is invalid at respawn time, it is deleted from memory (like in vanilla). The plugin will continue to drop records until it finds a valid spawn point, at respawn time.
- What happens if I just never die?
- Then you don't get to take advantage of this plugin!
- Can you make this for below 1.21.5?
- Maybe if you can tell me the alternative to the function call
isMissingRespawnBlock() that was added in this commit in Paper 1.21.5. I don't want to work around that.
Configuration options
# How many previous spawn points to consider when finding a fallback respawn.
fallback-candidates: 5
# Maximum spawn points to store per player. Oldest are dropped when exceeded.
# Set to 0 for unlimited.
max-stored-spawns: 100
# Behavior on fallback:
# - LAST_N: Consider only the N most recent spawn points (incl. invalid)
# - LAST_N_VALID: Consider only the N most recent *valid* spawn points
# - LAST_N_IN_DIMENSION: Consider only the N most recent spawn points in that dimension (incl. invalid)
# - LAST_N_VALID_IN_DIMENSION: Consider only the N most recent *valid* spawn points in that dimension
# Note: this policy affects what records are safe to clean up at respawn time, independent of max-stored-spawns.
# For example, LAST_N_VALID will drop all records, both valid and invalid past the Nth valid spawn point it finds.
fallback-policy: LAST_N_VALID
# How often to autosave spawn records (in minutes). Set to 0 to never autosave.
autosave-interval: 5
# What to say to players when they fall back to a new location. Set to "" to omit a message.
fallback-respawn-message: "Your respawn was updated to a new location"
# Enable debug functionality (server logs when spawn changes, record changes, etc.)
debug-mode: false
Command usage
This plugin does not use any commands.
How do I tell you that your plugin is broken?
Report issues with my spaghetti code through the issue tracker on the plugin's GitHub repository.
How do I build this plugin myself?
- Clone this repository:
git clone https://github.com/ganyuke/BedBackBetter.git
- Change directory:
cd BedBackBetter
- Build the
.jar: ./gradlew build
- Find the built
.jar in build/libs/
How do I submit features for this plugin?
If you wrote the code for it, I'll happily accept a pull request if I feel like it doesn't bloat the scope of this plugin. Ensure that you use the pull request template.
By submitting a contribution to this repository, you agree that your contribution is licensed under the same license as this repository, as published in the LICENSE file.
License
Unless otherwise noted, all source code in this repository is licensed under the Mozilla Public License 2.0 (SPDX: MPL-2.0). Please view the LICENSE file for the terms you are afforded under the MPL-2.0.
评论 0
登录后参与评分
还没有评论,来抢沙发吧