PlotRand
/rand 打开一个 GUI,地块所有者可以在其中为自己的 PlotSquared 地块选择边界样式。每种样式都受其各自的权限控制(plotrand.style.<id>),因此等级/捐赠者系统可以按组解锁更多样式,而无需修改插件本身。
尚未在正式服务器上测试——请参阅下方的已知限制。
要求
命令
| 命令 |
描述 |
/rand |
打开你所在地块的边界 GUI(必须是你拥有的地块) |
/rand set <style> |
直接设置样式,无需使用 GUI |
/rand remove |
移除边界并恢复原始方块 |
/rand info |
显示当前应用的样式 |
/rand admin reload |
重新加载 config.yml |
/rand admin set <style> |
强制为管理员所站立的地块设置边界,绕过所有权和冷却时间 |
在 GUI 中,左键点击应用样式,右键点击预览它:圆环会沿着地块边缘出现 preview-seconds(默认为 10 秒),仅对你可见。世界中没有任何变化,因此预览不消耗冷却时间,被锁定的样式也可以进行预览。
权限
plotrand.use(默认:true)- 允许打开 /rand
plotrand.admin(默认:op)- 管理员子命令
plotrand.style.<id> - 对应 config.yml 中的每种样式,默认值请参见 plugin.yml
配置
所有样式、GUI 布局、冷却时间和边界高度偏移量都位于 config.yml 中。通过复制 styles: 下的区块来添加新样式,然后在 plugin.yml 中也声明其权限,以便权限插件能够列出它。
样式会在配置加载时进行验证。如果样式的材料无法作为方块放置、没有用于在 GUI 中显示的物品形式、占据的 GUI 槽位太小无法显示,或者想要占用另一个样式已使用的槽位,则该样式会被跳过,并在控制台中显示原因——这比在构建中途失败要好。
边界放置原理
圆环遵循地块已认领区域的轮廓。对于合并的地块,这是其区域的并集轮廓,而不是包围盒:L 形合并的包围盒会延伸到所有者未拥有的地块中,在那里建造会修改他人的地块。两个合并子地块相接的接缝处会被排除,以便合并后的地块被视为一个整体形状。
方块在放置时不会触发物理更新,因此由数百个方块组成的圆环不会在地块边缘引发沙子掉落、红石或水流流动。
已知限制
- 边界高度:圆环放置在玩家站立的 Y 级别(加上
border-height-offset),而不是 PlotSquared 定义的地面高度。这在平坦的地块世界中效果良好;在有起伏的地形上,所有者需要站在他们希望圆环出现的位置。
- 管理员
set 仅针对管理员物理站立的地块——目前还没有通过地块 ID 查找的功能。
- 恢复原始方块(
/rand remove,或切换样式)会重播在首次应用边界时拍摄的快照。之后在这些确切坐标上通过其他方式放置的方块将被覆盖。如果在 Minecraft 更新后存储的方块类型不再存在,整个还原操作将被拒绝,并保留存储的数据,而不是让边界因原始方块已被删除而孤立无援。
applyStyle 在主线程上运行,将强制加载地块边缘沿线的未加载区块。仅遍历轮廓(而非地块内部区域),因此开销与边缘长度成正比,但非常大的地块仍可能导致短暂的卡顿。状态文件以异步方式写入。
构建
mvn clean package
需要访问 repo.papermc.io(Paper)、Maven Central(PlotSquared)和 maven.enginehub.org(WorldEdit, SquirrelID)。生成的 jar 包位于 target/ 中;Paper、PlotSquared 和 WorldEdit 均为 provided 范围,不会被打包进 jar 中。
WorldEdit 锁定在 7.3.19 版本:Plot#getRegions() 返回的是 WorldEdit 类型,而从 7.4.0 开始,WorldEdit 提供了 Java 25 类文件,Java 21 构建环境无法读取。代码故意使用 BlockVector3.getX() 而不是较新的 x(),因为后者仅在 WorldEdit 7.3.0 及以上版本中存在,而运行时版本取决于服务器提供的版本。
PlotRand
/rand opens a GUI where a plot owner picks a border style for their own
PlotSquared plot. Every style is gated behind its own permission
(plotrand.style.<id>), so a rank/donor system can unlock more styles per
group without touching the plugin.
Not yet tested on a live server - see Known limitations below.
Requirements
- Paper 1.21.x
- PlotSquared 7.x (hard dependency, plugin refuses to enable without it)
Commands
| Command |
Description |
/rand |
Opens the border GUI for the plot you're standing on (must be yours) |
/rand set <style> |
Sets a style directly, without the GUI |
/rand remove |
Removes the border and restores the original blocks |
/rand info |
Shows the currently applied style |
/rand admin reload |
Reloads config.yml |
/rand admin set <style> |
Force-sets a border on the plot the admin is standing on, bypassing ownership and cooldown |
In the GUI, a left click applies a style and a right click previews it: the ring appears along
the plot edge for preview-seconds (10 by default), visible only to you. Nothing in the world
changes, so a preview costs no cooldown, and locked styles can be previewed as well.
Permissions
plotrand.use (default: true) - allows opening /rand at all
plotrand.admin (default: op) - admin subcommands
plotrand.style.<id> - one per style in config.yml, see plugin.yml for the defaults
Configuration
All styles, the GUI layout, the cooldown, and the border height offset live
in config.yml. Add a new style by copying a block under styles:, then
declare its permission in plugin.yml too so permission plugins can list it.
Styles are validated when the config loads. A style is skipped, with a reason
in the console, when its material cannot be placed as a block, has no item
form to show in the GUI, sits in a slot the GUI is too small to show, or wants
a slot another style already uses - instead of failing later mid-build.
How the border is placed
The ring follows the outline of the plot's claimed area. For a merged plot
that is the outline of the union of its regions, not their bounding box: an
L-shaped merge has a bounding box that reaches into a plot the owner does not
own, and building there would modify someone else's plot. Seams where two
merged sub-plots meet are left out, so a merged plot reads as one shape.
Blocks are placed without physics updates, so a ring of several hundred blocks
does not set off falling sand, redstone or water flow along the plot edge.
Known limitations
- Border height: the ring is placed at the Y level the player is standing
on (plus
border-height-offset), not at a PlotSquared-defined floor height.
Fine for flat plot worlds; on varied terrain the owner has to stand where
they want the ring.
- Admin
set only targets the plot the admin is physically standing on -
there is no lookup-by-plot-ID yet.
- Restoring the original blocks (
/rand remove, or switching styles) replays a
snapshot taken when the border was first applied. Blocks placed by other
means on those exact coordinates afterwards are overwritten. If a stored
block type no longer exists after a Minecraft update, the restore is refused
as a whole and the stored data is kept, rather than stranding the border with
its originals already deleted.
applyStyle runs on the main thread and will force-load unloaded chunks
along the plot's edge. Only the outline is walked (not the plot's area), so
the cost scales with edge length, but a very large plot may still hitch
briefly. The state file is written asynchronously.
Building
mvn clean package
Needs network access to repo.papermc.io (Paper), Maven Central (PlotSquared)
and maven.enginehub.org (WorldEdit, SquirrelID). The resulting jar is in
target/; Paper, PlotSquared and WorldEdit are provided and not shaded in.
WorldEdit is pinned to 7.3.19: Plot#getRegions() returns WorldEdit types, and
from 7.4.0 on WorldEdit ships Java 25 class files that a Java 21 build cannot
read. The code deliberately uses BlockVector3.getX() rather than the newer
x(), since the latter only exists from WorldEdit 7.3.0 and the runtime
version is whatever the server provides.
评论 0
登录后参与评分
还没有评论,来抢沙发吧