BlockProt Legacy(适用于 Minecraft 1.18.2 - 1.20.4)。需要其他 Minecraft 版本?请参阅版本指南。
请保持在最新版本! 建议始终更新,即使仅落后一个构建版本,也能获得安全性、Folia 支持及兼容性修复。从 GitHub Releases 或 Modrinth 下载最新的 BlockProt Legacy 构建。
BlockProt Legacy 是 BlockProt 的一个维护分支,适用于 Paper、Purpur 和 Folia 服务器(Minecraft 1.18.2 - 1.20.4)。它在保留原始基于 NBT 的保护核心的同时,增加了稳定性修复、性能优化以及上游版本中不存在的新功能。
功能介绍
玩家潜行并右键点击任何可锁定的方块或实体即可打开保护 GUI:无需使用命令。在 GUI 中,玩家可以锁定或解锁方块、管理每个方块的友方列表并将方块设为公开、控制红石和漏斗的访问权限、检查访问审计记录,以及在方块之间复制和粘贴设置。
管理员拥有独立的管理工具集:分页方块浏览器(/bp lockables)、按玩家分组的方块列表(/bp info)、解锁 GUI(/bp unlock)、员工角色管理(/bp tiers)、诊断工具(/bp debug run),以及每个受保护方块的完整审计日志。
受保护的物件
只有存在于你当前 Minecraft 版本中的方块和实体才能被锁定;以下列表列出了各版本中完整的受保护对象集合。
Tile entities(存储类): 所有箱子变体、全部 17 种潜影盒颜色、全部 12 种书架变体(1.21.9+)、熔炉、烟熏炉、高炉、漏斗、发射器、投掷器、 barrels、酿造台、装饰罐、雕纹书架、工匠台、唱片播放机、讲台、蜂巢、蜂箱。
交互型方块: 门、陷阱门和栅栏门(所有木材变体加上铁质以及所有铜氧化阶段)、铁砧、坩埚、附魔台、砂轮、切石机、织布机、制图台、锻造台、堆肥桶、钟、音符盒、龙蛋。
实体: 物品展示框、发光物品展示框、带箱子的船(所有木材变体)、带箱子的矿车、漏斗矿车。驯服的动物(狼、猫、鹦鹉、马、羊驼)以及不可驯服但可保护的实体(村民)通过实体保护系统进行保护。
所有方块列表均在 blocks.yml 中定义,并且可以在不重启服务器的情况下动态更改。
本分支新增的功能
修复了锁定菜单布局
Block Lock GUI 中的每个按钮现在在所有方块和实体类型中都占据固定的槽位。以前,如果缺少某个按钮(例如工作台没有红石按钮),会导致后续所有按钮向左移位,使得不同方块类型的菜单不一致。
实体保护
可以保护驯服的动物(狼、猫、鹦鹉、马、羊驼)和村民。手持配置好的菜单物品(默认:木棍)右键点击你的实体以打开保护 GUI。默认禁用;请在 config.yml 的 entity_protection 下启用。此功能在早期版本中名为 pet_protection:升级时旧键会自动迁移,无需手动编辑。
村民工作站保护
其工作记忆指向受保护工作站方块的村民,将自动继承该方块的保护状态。非所有者无法伤害或与关联的村民交易,也无法破坏或交互工作站周围配置区域内的方块。在工作站的锁定菜单中会出现一个“定位关联村民”的绿宝石按钮,仅在点击者可见的情况下在村民位置显示简短的粒子效果。可在 config.yml 中配置:
villager_workstation_protection:
enabled: true
radius: 2 # 水平搜索半径 (0-8)
vertical_radius: 1 # 垂直搜索半径 (0-4)
物品展示框保护与自动方块链接
物品展示框和发光物品展示框采用相同的潜行+右键流程进行保护。放置在可锁定方块面上的展示框会自动与该方块链接:它完全共享该方块的拥有者、好友列表和锁定状态,与其交互会直接打开该方块的锁定菜单。未安装在可锁定方块上的展示框则保持独立的实体保护流程。
储物载具保护
带箱子的船、储物矿车和漏斗矿车支持相同的潜行+右键流程。一旦受到保护,非所有者无法打开其库存,且载具会受到防破坏和保护。漏斗提取功能可以通过菜单内的红石按钮为每个载具单独切换。
方块家族表达式系统
blocks.yml 和 worlds.yml 支持紧凑的家族表达式, alongside 标准的平面材质列表:
lockable_tile_entities:
- "[*]" # 所有 tile entities
- "[*-CHEST -*SIGN]" # 所有箱子,不含告示牌
lockable_entities:
- "[*-CHEST_BOATS ITEM_FRAME]" # 仅限带箱子的船和物品展示框
子家族分类:CHEST、FURNACE、SHELF、TRANSPORT、MISC、SIGN(tile entities);SHULKERS;ANVIL、CAULDRON、WORKSTATION、TRAPDOOR、FENCE_GATE(方块);DOORS;CHEST_BOATS、CHEST_MINECARTS、HOPPER_MINECARTS、ITEM_FRAMES(实体)。
完整语法说明:docs/MODERN SYNTAX AND LEGACY/BLOCK_FAMILY_SYNTAX.md。完整材质列表:docs/MODERN SYNTAX AND LEGACY/LOCKABLE_BLOCKS_REFERENCE.md。
配置与方块在每次重载时自动合并
每次启动及执行 /bp reload 时,缺失的键将从 JAR 默认值中添加,重命名的键将进行迁移。现有值(包括 blocks.yml 中已写入的所有家族表达式)永远不会被覆盖或重新排序。在传统扁平列表模式下,来自较新 JAR 的新材料条目会自动追加,从而使新的方块类型无需手动编辑即可上锁。
袭击检测
监控接近可上锁方块的爆炸事件。记录该事件,若玩家在线则通过操作栏和聊天发送警告,否则将警告排队以待下次登录时交付。可通过 raid_detection.enabled 进行配置。
StatHandler 稳定性
saveFile() 已重写,采用临时写入、验证、备份、替换的顺序,并为不支持原子跨目录移动的文件系统提供回退机制(修复了 Windows 上的 Failed to swap backup NBT file 错误)。Caffeine 缓存将对每个玩家的过期条目扫描节流至每玩家每 60 秒一次。区块加载保护器防止在 purgeStalePbsEntries 中进行同步区块加载。
性能
- 对
HopperEventListener 和 HybridDatabase 使用有界 Caffeine 缓存,通过 ProtectedBlockCache 实现漏斗的 O(1) 早期退出,而不会阻塞服务器或 Folia 区域线程。
purgeStalePbsEntries 完全跳过未加载的区块,以防止主线程停顿。
- 线程安全的 SQLite 审计日志 (
blockprot_audit.sqlite),带有序列化的 WAL 连接处理。
其他新增功能
- 访问审计日志 (
/bp logs [here|player <name>|<page>]):分页的 SQLite 审计历史,用于检查容器开启、物品交易和拒绝的访问。
- 双向漏斗和拾取物品保护:防止在未授权的提取、非法物品插入以及锁定容器和存储车辆上的
InventoryPickupItemEvent 窃取行为。
- 环境和特殊容器保护:保护装饰罐免受投射物攻击,强制执行雕刻书架的每槽位
READ/WRITE 访问权限,阻止火源点燃/蔓延、液体流动 (BlockFromToEvent)、未经授权的桶注水、掉落方块以及受保护容器的发射器红石激活,并保护实体免受伤害、投射物和拴绳的影响。
- 活塞挤压和移动保护:防止活塞移动或挤压已上锁的方块和容器。
- 离线模式 UUID 隔离:当
online-mode: false 时绕过 Mojang HTTP 查找,并在 Bedrock 前缀检查时剥离握手查询参数。
- 动态功能门控和管理员层级继承:干净地隐藏禁用的命令 (
/bp tiers, /bp friends, /bp logs),将玩家 use_menus 聊天命令限制为 /bp user 和 /bp admin,强制执行 t2 继承,并允许显式的权限否定覆盖 OP 回退。
- 多层级管理员权限 (
admin_tiers.enabled) 和独立的 admins.yml 层级结构。
- 原生 Paper 对话框:此版本不可用。所有菜单均以箱子库存形式打开。
- Bedrock 触摸表单(通过 Geyser 和 Floodgate 的 Cumulus API)。
- 所有权转移:
/bp transferall <player> 将你所有的方块所有权转移给另一名玩家。
- 通过
worlds.yml 实现按世界配置 (per_worlds_config: true)。
- 通过
ConfigFileWatcher 实现自动重载 (auto_reload_configs,默认为 true)。
- 版本升级时自动生成备份 zip 文件。
- 旧版文件夹迁移:在重命名后的首次启动时自动从
BlockProt 或 BlockProtPlus 文件夹复制数据。
- SQLite 用户缓存移至插件数据文件夹;旧文件会自动迁移。
- 不活跃清理:移除属于长期不活跃玩家的保护 (
inactivity_cleanup_days,默认禁用)。
- WorldEdit 粘贴自动上锁(默认禁用)。
- PlaceholderAPI 占位符:
%blockprot_global_block_count%, %blockprot_own_block_count%, %blockprot_default_friends%。
- 通过 FoliaLib 实现 Folia 兼容性。
- ViaVersion、ViaBackwards 和 ViaRewind 检测。
命令
| 命令 |
权限 |
描述 |
/bp user |
blockprot.user |
主要个人用户菜单或对话框 |
/bp admin |
blockprot.user.admin |
管理控制菜单或对话框 |
/bp friends |
blockprot.user |
管理全局默认好友列表 |
/bp settings |
blockprot.user |
个人玩家偏好设置界面 |
/bp logs [here|player <name>|<page>] |
blockprot.user / Admin |
查看自身、目标方块或其他玩家的访问审计日志 |
/bp transferall <player> |
blockprot.user |
将所有你保护的方块所有权转移给另一名玩家 |
/bp lockables |
blockprot.user.admin |
分页 GUI 列出所有具有活动/非活动状态的方块和实体 |
/bp tiers |
blockprot.user.admin 或 blockprot.user.admin.owner |
员工角色 GUI 和自定义权限管理器 |
/bp info <player> |
blockprot.user.admin |
某名玩家拥有的所有方块,附带传送链接 |
/bp unlock <player> |
blockprot.user.admin |
检查或删除任何玩家的保护(控制台:列出它们) |
/bp protdel [world] |
blockprot.user.admin |
批量删除世界中的保护,支持撤销 |
/bp reload |
blockprot.user.admin |
重载所有配置文件并合并缺失的键 |
/bp update |
blockprot.user.admin |
检查并下载 GitHub 发布更新 |
/bp integrations |
blockprot.user.admin |
检查所有第三方集成的状态 |
/bp recommended <blocks|config|all> |
blockprot.user.admin.owner |
应用推荐的配置配置文件 |
/bp debug run |
blockprot.user.admin 或 blockprot.debug |
运行内部诊断(也可从控制台运行) |
权限
| 权限 |
默认值 |
描述 |
blockprot.user |
true |
所有标准玩家功能 |
blockprot.user.admin |
op |
管理员命令和图形界面 |
blockprot.user.admin.t1 |
false |
初级员工层级(阻止列表、只读方块信息和审计日志) |
blockprot.user.admin.t2 |
false |
中级员工层级(解锁、可锁定物品、破坏受保护的方块) |
blockprot.user.admin.t3 |
false |
高级员工层级(世界保护删除、配置、调试) |
blockprot.user.admin.owner |
op |
完全所有者控制权及员工角色分配 |
blockprot.lockmax |
false |
豁免方块数量限制(无上限) |
blockprot.locklimit.<N> |
false |
单玩家上限覆盖(例如 blockprot.locklimit.500) |
blockprot.blocks.tp |
op |
从统计数据和管理员 GUI 传送至方块处 |
blockprot.debug |
op |
访问 /bp debug 命令 |
仅当 admin_tiers.enabled: true 时,员工层级节点才生效。
兼容性
|
|
| Minecraft |
1.18.2 - 1.20.4 |
| 服务端软件 |
Paper, Purpur, Folia |
| Java |
需要 Java 17+ |
| MySQL |
MySQL 8+, MariaDB 10.5+(可选) |
| 语言 |
GitLocalize 上提供 25 种语言:AR, CS, DE, EN, ES, FI, FR, HE, HU, ID, IT, JA, KO, NL, PL, PT-BR, RO, RU, SK, SV, TH, TR, UK, ZH-CN, ZH-TW |
集成支持
Towny, WorldGuard, Zelly's Guard, Lands, ClaimChunk, GriefPrevention, Residence, PlaceholderAPI, SkinsRestorer, WorldEdit/FAWE, Floodgate/Geyser, ViaVersion/ViaBackwards/ViaRewind, Folia.
安装
将 JAR 文件放入 plugins/ 目录并重启服务器。需要 Java 17+ 以及 Paper、Purpur 或 Folia 1.18.2 - 1.20.4。升级时会自动迁移配置键,无需手动编辑。
文档
仓库地址:
问题反馈与贡献:
许可证:GNU General Public License v3 - 基于 spnda 开发的 BlockProt。
BlockProt Legacy (Minecraft 1.18.2 - 1.20.4). Looking for another Minecraft version? See the version guide.
Stay on the latest build! Updating is always recommended, even when only 1 build behind, for security, Folia, and compatibility fixes. Download the latest BlockProt Legacy build from GitHub Releases or Modrinth.
BlockProt Legacy is a maintained fork of BlockProt for Paper, Purpur, and Folia servers (Minecraft 1.18.2 - 1.20.4). It preserves the original NBT-based protection core while adding stability fixes, performance improvements, and new features not present upstream.
What it does
Players sneak and right-click any lockable block or entity to open the protection GUI: no commands required. From the GUI they can lock or unlock, manage a per-block friend list and make blocks public, control redstone and hopper access, inspect the access audit trail, and copy and paste settings between blocks.
Admins get a separate toolset: a paged block browser (/bp lockables), per-player block lists (/bp info), an unlock GUI (/bp unlock), staff roles management (/bp tiers), diagnostics (/bp debug run), and a full audit log per protected block.
What is protected
Only blocks and entities that exist on your Minecraft version can be locked; the lists below name the complete set across editions.
Tile entities (storage): all chest variants, all 17 shulker box colors, all 12 shelf variants (1.21.9+), furnace, smoker, blast furnace, hopper, dispenser, dropper, barrel, brewing stand, decorated pot, chiseled bookshelf, crafter, jukebox, lectern, beehive, bee nest.
Interactive blocks: doors, trapdoors, and fence gates (all wood variants plus iron and all copper oxidation stages), anvils, cauldrons, enchanting table, grindstone, stonecutter, loom, cartography table, smithing table, composter, bell, note block, dragon egg.
Entities: item frames, glowing item frames, chest boats (all wood variants), chest minecarts, hopper minecarts. Tamed animals (wolves, cats, parrots, horses, llamas) and non-tameable protectable entities (villagers) via the entity protection system.
All block lists are defined in blocks.yml and can be changed at runtime without restarting.
Features added in this fork
Fixed lock menu layout
Every button in the Block Lock GUI now occupies a fixed slot across all block and entity types. Previously, a missing button (for example, no Redstone button on a workstation) caused all subsequent buttons to shift left, making the menu inconsistent between block types.
Entity protection
Tamed animals (wolves, cats, parrots, horses, llamas) and villagers can be protected. Right-click your entity while holding the configured menu item (default: Stick) to open the protection GUI. Disabled by default; enable under entity_protection in config.yml. Renamed from pet_protection in earlier versions: the old key is migrated automatically on upgrade, no manual edit needed.
Villager workstation protection
A villager whose job-site memory points to a protected workstation block inherits that block's protection automatically. Non-owners cannot damage or trade with the linked villager and cannot break or interact with blocks in a configurable area around the workstation. A "Locate linked villager" Emerald button appears in the workstation's lock menu, showing a short particle effect at the villager's location visible only to the clicking player. Configurable in config.yml:
villager_workstation_protection:
enabled: true
radius: 2 # horizontal search radius (0-8)
vertical_radius: 1 # vertical search radius (0-4)
Item frame protection with automatic block linking
Item frames and glowing item frames are protected with the same sneak-and-right-click flow. A frame placed on the face of a lockable block is automatically linked to that block: it shares the block's owner, friends, and lock state exactly, and interacting with it opens the block's lock menu directly. Frames not mounted on a lockable block keep the standalone entity-protection flow.
Storage vehicle protection
Chest boats, storage minecarts, and hopper minecarts support the same sneak-and-right-click flow. Once protected, non-owners cannot open the inventory, and the vehicle is protected from damage and destruction. Hopper extraction can be toggled per vehicle from the in-menu Redstone button.
Block family expression system
blocks.yml and worlds.yml support compact family expressions alongside standard flat material lists:
lockable_tile_entities:
- "[*]" # all tile entities
- "[*-CHEST -*SIGN]" # all chests, no signs
lockable_entities:
- "[*-CHEST_BOATS ITEM_FRAME]" # chest boats and item frames only
Sub-families: CHEST, FURNACE, SHELF, TRANSPORT, MISC, SIGN (tile entities); SHULKERS; ANVIL, CAULDRON, WORKSTATION, TRAPDOOR, FENCE_GATE (blocks); DOORS; CHEST_BOATS, CHEST_MINECARTS, HOPPER_MINECARTS, ITEM_FRAMES (entities).
Full syntax: docs/MODERN SYNTAX AND LEGACY/BLOCK_FAMILY_SYNTAX.md. Full material list: docs/MODERN SYNTAX AND LEGACY/LOCKABLE_BLOCKS_REFERENCE.md.
Config and blocks auto-merge on every reload
On every startup and /bp reload, missing keys are added from JAR defaults and renamed keys are migrated. Existing values: including every family expression already written in blocks.yml: are never overwritten or reordered. In legacy flat-list mode, new material entries from a newer JAR are appended automatically so new block types become lockable without manual edits.
Raid detection
Monitors explosions near lockable blocks. Logs the event, alerts the owner via action bar and chat if online, or queues the alert for delivery at next login. Configurable via raid_detection.enabled.
StatHandler stability
saveFile() was rewritten to use a temp-write, validate, backup, replace sequence with a fallback for filesystems that do not support atomic cross-directory moves (fixes Failed to swap backup NBT file on Windows). A Caffeine cache throttles the per-player stale-entry scan to once per 60 seconds per player. A chunk-load guard prevents synchronous chunk loads in purgeStalePbsEntries.
Performance
- Bounded Caffeine caches on
HopperEventListener and HybridDatabase for O(1) hopper early-exit via ProtectedBlockCache without stalling server or Folia region threads.
purgeStalePbsEntries skips unloaded chunks entirely to prevent main-thread stalls.
- Thread-safe SQLite audit logging (
blockprot_audit.sqlite) with serialized WAL connection handling.
Other additions
- Access audit logs (
/bp logs [here|player <name>|<page>]): paginated SQLite audit history for inspecting container opens, item transactions, and denied accesses.
- Bidirectional hopper and item-pickup protection: prevents unauthorized extraction, illegal item insertion, and
InventoryPickupItemEvent siphoning on locked containers and storage vehicles.
- Environmental and special container protection: shields decorated pots from projectiles, enforces per-slot
READ/WRITE access on chiseled bookshelves, blocks fire ignition/spread, liquid flow (BlockFromToEvent), unauthorized bucket waterlogging, falling blocks, and dispenser redstone activation against protected containers, and protects entities from damage, projectiles, and leashes.
- Piston crushing and movement protection: prevents pistons from moving or crushing locked blocks and containers.
- Offline-mode UUID isolation: bypasses Mojang HTTP lookups when
online-mode: false and strips handshake query parameters on Bedrock prefix checks.
- Dynamic feature gating and staff tier inheritance: hides disabled commands (
/bp tiers, /bp friends, /bp logs) cleanly, restricts player use_menus chat commands to /bp user and /bp admin, enforces t2 inheritance, and lets explicit permission negations override OP fallback.
- Multi-tier staff permissions (
admin_tiers.enabled) and standalone admins.yml hierarchy.
- Native Paper Dialogs: not available in this edition. Every menu opens as a chest inventory.
- Bedrock touch forms (Cumulus API via Geyser and Floodgate).
- Ownership transfer:
/bp transferall <player> moves ownership of all your blocks to another player.
- Per-world configuration via
worlds.yml (per_worlds_config: true).
- Auto-reload via
ConfigFileWatcher (auto_reload_configs, default true).
- Automatic backup zip on version upgrade.
- Legacy folder migration: copies data from
BlockProt or BlockProtPlus folders automatically on first boot after rename.
- SQLite usercache moved into the plugin data folder; old file is migrated automatically.
- Inactivity cleanup: removes protections owned by long-inactive players (
inactivity_cleanup_days, disabled by default).
- WorldEdit paste auto-lock (disabled by default).
- PlaceholderAPI placeholders:
%blockprot_global_block_count%, %blockprot_own_block_count%, %blockprot_default_friends%.
- Folia compatibility via FoliaLib.
- ViaVersion, ViaBackwards, and ViaRewind detection.
Commands
| Command |
Permission |
Description |
/bp user |
blockprot.user |
Main personal user menu or dialog |
/bp admin |
blockprot.user.admin |
Administrative control menu or dialog |
/bp friends |
blockprot.user |
Manage global default friends list |
/bp settings |
blockprot.user |
Personal player preferences interface |
/bp logs [here|player <name>|<page>] |
blockprot.user / Admin |
View access audit logs for self, targeted block, or another player |
/bp transferall <player> |
blockprot.user |
Transfer ownership of all your protected blocks to another player |
/bp lockables |
blockprot.user.admin |
Paged GUI listing all blocks and entities with active/inactive status |
/bp tiers |
blockprot.user.admin or blockprot.user.admin.owner |
Staff roles GUI and custom permissions manager |
/bp info <player> |
blockprot.user.admin |
All blocks owned by a player with teleport links |
/bp unlock <player> |
blockprot.user.admin |
Inspect or remove any player's protections (console: lists them) |
/bp protdel [world] |
blockprot.user.admin |
Bulk delete protections in a world with undo support |
/bp reload |
blockprot.user.admin |
Reload all config files and merge missing keys |
/bp update |
blockprot.user.admin |
Check and download GitHub release updates |
/bp integrations |
blockprot.user.admin |
Inspect status of all third-party integrations |
/bp recommended <blocks|config|all> |
blockprot.user.admin.owner |
Apply recommended configuration profiles |
/bp debug run |
blockprot.user.admin or blockprot.debug |
Run internal diagnostics (also from the console) |
Permissions
| Permission |
Default |
Description |
blockprot.user |
true |
All standard player features |
blockprot.user.admin |
op |
Admin commands and GUIs |
blockprot.user.admin.t1 |
false |
Low staff tier (block lists, read-only block info and audit logs) |
blockprot.user.admin.t2 |
false |
Medium staff tier (unlock, lockables, break protected blocks) |
blockprot.user.admin.t3 |
false |
High staff tier (world protection deletion, config, debug) |
blockprot.user.admin.owner |
op |
Full owner control and staff role assignment |
blockprot.lockmax |
false |
Exempt from the block count limit (unlimited) |
blockprot.locklimit.<N> |
false |
Per-player cap override (e.g. blockprot.locklimit.500) |
blockprot.blocks.tp |
op |
Teleport to blocks from stats and admin GUIs |
blockprot.debug |
op |
Access to /bp debug |
The staff tier nodes only apply with admin_tiers.enabled: true.
Compatibility
|
|
| Minecraft |
1.18.2 - 1.20.4 |
| Server software |
Paper, Purpur, Folia |
| Java |
Java 17+ required |
| MySQL |
MySQL 8+, MariaDB 10.5+ (optional) |
| Languages |
25 languages on GitLocalize: AR, CS, DE, EN, ES, FI, FR, HE, HU, ID, IT, JA, KO, NL, PL, PT-BR, RO, RU, SK, SV, TH, TR, UK, ZH-CN, ZH-TW |
Integrations
Towny, WorldGuard, Zelly's Guard, Lands, ClaimChunk, GriefPrevention, Residence, PlaceholderAPI, SkinsRestorer, WorldEdit/FAWE, Floodgate/Geyser, ViaVersion/ViaBackwards/ViaRewind, Folia.
Install
Place the JAR in plugins/ and restart. Requires Java 17+ and Paper, Purpur, or Folia 1.18.2 - 1.20.4. On upgrade, config keys are migrated automatically: no manual edits required.
Documentation
Repository:
Issues and contributions:
License: GNU General Public License v3 - based on BlockProt by spnda.
评论 0
登录后参与评分
还没有评论,来抢沙发吧