ChestKey
ChestKey 是一款适用于 Paper(1.21.11)的 Minecraft 插件,用于使用独特的钥匙来锁定和保护箱子。它基于 Java 服务器运行,要求使用 Paper API 1.21 或更高版本,并且仅使用官方的 Adventure API 来处理文本。该插件不需要 NMS 或反射机制。
功能特性
-
独特钥匙:每把钥匙都是一个 TRIPWIRE_HOOK(绊线钩),在 PersistentDataContainer 中包含一个随机 UUID,在 Lore(描述)中显示可见的短 ID,并带有闪光效果。
-
锁定/解锁箱子:手持钥匙对箱子(包括陷阱箱)进行Shift+右键点击,即可将箱子与钥匙绑定而不会消耗钥匙。双格箱子被视为一个整体单元。
-
开启方式:只有主手或副手中持有正确钥匙的玩家才能打开锁定的箱子。如果钥匙错误或缺失,则无法打开箱子,并会显示粒子效果和指示器。
-
破坏规则:锁定的箱子只能使用正确的钥匙才能破坏。拥有 chestlock.admin.break 权限的管理员可以破坏任何箱子。
-
合成复制:将一把钥匙和一个铁锭混合(通过 Shapeless 形状不固定配方),可以生产出两把具有相同 UUID 的钥匙。
-
绕过保护:漏斗、活塞和爆炸不会影响锁定的箱子。
-
可配置的视觉效果:可以在 config.yml 中开启或关闭粒子效果和小型提示牌。
安装方法
- 使用 Maven 构建项目:
mvn package
- 将生成的 JAR 文件(
target/chestlock-1.0-SNAPSHOT.jar)复制到 Paper 服务器的 plugins 目录中。
- 启动服务器。首次启动时,插件数据文件夹中将创建
messages.yml 和 config.yml 文件。
- 根据需要自定义
messages.yml 或 config.yml。
配置说明
config.yml 目前包含两个选项:
visual:
particles: true
indicator: true
particles:当尝试打开失败以及锁定完成后激活粒子效果。
indicator:在箱子上方显示临时的“已关闭”提示牌。
插件归档文件中包含了完整的示例配置文件。
消息设置
所有文本均来自 messages.yml 文件,并使用 MiniMessage 格式。你可以自定义此文件以使用翻译文本或自定义颜色。
示例条目:
chest:
locked: ‘<red>This chest is locked and you do not have the right key.’
ChestKey
ChestKey is a Minecraft plugin for Paper (1.21.11) for locking and
protecting chests using unique keys. It works on
Java-based servers using Paper API 1.21 or higher and uses
only the official Adventure API for texts. It does not require NMS
or Reflection.
Features
-
Unique keys: Each key is a TRIPWIRE_HOOK with a
random UUID in the PersistentDataContainer, a visible short ID in the
Lore, and a glitter effect.
-
Lock/unlock chest: Shift-right-click on a (Trapped)Chest
with a key links the chest to the key without consuming it.
Double chests are treated as a single unit.
-
Opening: Only players with a key in their main or off-hand can
open locked chests. Incorrect or missing keys block
opening and display particles/indicators.
-
Break rules: Locked chests can only be broken with the correct key.
Admins with chestlock.admin.break can break any chest.
-
Crafting duplication: Mixing a key and an iron ingot
produces two keys with identical UUIDs (provided by a
Shapeless recipe).
-
Bypass protection: Hoppers, pistons, and explosions cannot affect
locked chests.
-
Configurable visual effects: Particles and small hint signs
can be turned on/off in config.yml.
Installation
- Build the project with Maven:
mvn package
- Copy the generated JAR (
target/chestlock-1.0-SNAPSHOT.jar) to the
plugins directory of your Paper server.
- Start the server. When starting for the first time,
messages.yml and
config.yml will be created in the plugin data folder.
- Customise
messages.yml or config.yml as needed.
Configuration
config.yml currently contains two options:
visual:
particles: true
indicator: true
particles: activates particle effects when opening attempts fail
and after locking.
indicator: displays a temporary ‘closed’ sign above the chest.
A complete sample configuration is included in the plugin archive.
Messages
All texts come from messages.yml and use the
MiniMessage format. You
can customise this file to use translations or your own colours.
Example entries:
chest:
locked: ‘<red>This chest is locked and you do not have the right key.’
评论 0
登录后参与评分
还没有评论,来抢沙发吧