ServerSystem
家园、传送点、瞬移、套装、货币与 Moderation(管理)。133 个命令,每个均可独立开关,并提供从 EssentialsX 进出的迁移方式。
Essentials 是每个服务器几乎都会优先安装却鲜有人满意的插件。它能用,而且自 2011 年以来一直能用,但这恰恰也是问题所在:每位玩家一个 YAML 文件,无法在不重命名的情况下关闭的 /give 命令,以及对 Folia 一无所知。
ServerSystem 以过去十年的技术视角完成了同样的工作。玩家数据存储在数据库中。每个命令都可以单独禁用。每位玩家都可以阅读自己语言的内容。如果你决定这是个错误,只需一条命令即可将所有数据导出回 Essentials 的格式。
依赖项
- Paper 1.21.x 或更高版本,或其分支(Purpur、Pufferfish、Leaves)
- Folia 兼容,整个插件使用区域调度器
- Java 21
- Vault - 可选,仅用于让其他插件感知经济系统
- PlaceholderAPI - 可选,仅当你需要占位符时
首次启动时,Paper 会自动下载 HikariCP 和数据库驱动程序。这就是为什么 jar 包大小为半兆字节而不是二十字节的原因。
EssentialsX 迁移
/serversystem migrate here --dry-run
/serversystem migrate here
Dry run(试运行)会读取所有数据并告知你发现了什么,但不会写入任何内容。它会转移余额、家园、传送点、出生点、监狱、套装、物品价值价格、昵称、忽略列表、邮件、活跃静音状态以及 Essentials 共享的原版封禁列表。
你的 Essentials 文件夹不会被触碰。两边都不会删除任何内容,并且重复运行导入命令只会更新相同的行而不是加倍,因此你可以先导入,查看一下,修复某些问题后再次导入。
没有对应等价物的项目会被报告出来,而不是静默丢弃。来自 1.12 版本的数值物品 ID 在现代服务器上无法解析,而位于不再加载的世界中的家园也无法检查,因此这两者都会在报告中列出名称,而不是被猜测处理。
导回 Essentials
/serversystem migrate to essentials
/serversystem migrate to essentials --apply
第一条命令会将完整的 Essentials 数据文件夹写入 plugins/ServerSystem/essentials-export。第二条命令会将其直接写入 plugins/Essentials,并在写入前将现有内容复制到带时间戳的备份中。
提供此功能并非因为有人想回去。而是为了表明:一个无法离开某个插件的服务器,并没有真正选择该插件。
可开关的命令
commands.yml 中每个命令对应一个条目:
give:
enabled: true
aliases: []
permission: serversystem.command.give
cooldown: 0
cost: 0.0
enabled: false 不会隐藏命令或拒绝执行——它根本不会向服务器注册。它会从 /help 和 Tab 补全中消失,且该名称可供其他插件占用。这是 Essentials 做不到的部分:它拥有的命令始终由其拥有。
命令在运行时注册,而非列在 plugin.yml 中,这也是为什么所有配置都基于配置文件而非修改 jar 包的原因。Minecraft 原版已占用的名称(如 /give 和 /tp)是被有意接管的其他插件占用的名称则保持原状并在控制台中报告,除非你在 config.yml 的 override-commands 下列出它们。
后续版本添加的命令会将其默认值追加到文件末尾。你所做的任何更改永远不会被重写,你添加的注释也会保留。
存储
Essentials 为每位玩家保存一个 YAML 文件。在一个拥有三万名玩家的服务器上,执行 /baltop 意味着打开三万个文件,并且是在主线程上执行的。
在这里,所有内容都在一张表中。在线玩家保存在内存中,因此没有任何命令会等待查询。离线查找命中数据库一次并缓存五分钟,这使得 /balance SomeoneWhoLeftLastYear 能够瞬间完成。/baltop 只是一个 ORDER BY 查询,无论存在一百名玩家还是十万名玩家,其成本相同。
默认使用 SQLite,无需任何设置。当多个服务器需要共享余额、家园和处罚时使用 MySQL。
货币
余额使用 BigDecimal,而非 double。只要服务器交易几个月,shop 插件悄悄四舍五入支付金额,直到那时唯一证据就是玩家坚持认为他们少找了零钱,此时 double 类型才显现出问题。
所有更改都会被记录:涉及多少、留下了什么、是谁操作的以及原因。因此,“我的钱去哪了”这个问题有一个不依赖任何人记忆的答案。
ServerSystem 会向 Vault 注册自己,这样商店、职业和箱子插件就能以它们期望的方式与之交互。通过商店进行的购买会以与 /pay 命令完全相同的方式进行日志记录。
语言
玩家会根据其 Minecraft 客户端设置的语言提供服务。无需任何配置,西班牙玩家在德语服务器上也能看到西班牙语内容;如果客户端语言不符合阅读需求,玩家可以使用 /language 进行覆盖。
缺失的行会逐行回退,而不是整个文件回退,因此部分完成的翻译仍可正常使用,而不会变成一片空白文本。已包含英语、德语和法语。将其他语言文件放入 plugins/ServerSystem/lang,它便会在下次重载后出现在 /language 中。
传送
由一处统一决定预热时间、冷却时间、移动是否取消预热,以及目的地是否为玩家可生存的区域。为每个命令单独处理这些逻辑,正是导致某些插件中的 /home 尊重预热而 /warp 不尊重的原因。
在移动玩家之前会检查目的地。如果家位于被他人用岩浆填满的房间内,传送会被拒绝,而不是直接判死刑,因为坐标的安全性无法保证。
传送是异步的,这既是 Folia 的要求,也是对 Paper 服务器的友好支持:目标区块在非主线程加载,而非阻塞游戏刻。
管理
数据不会被删除。解除封禁会将该行标记为“非活跃”,并记录操作者,以便管理团队查看某玩家曾被封禁三次且每次均由同一人解封。
封禁记录绑定的是账号而非用户名,因此改名不会自动解除封禁。登录检查运行在异步预登录事件(async pre-login event)阶段,此时服务器尚未构建玩家对象,且采用单次索引查询而非遍历封禁列表文件。
警告可以触发自身行为。warnings.actions 配置项将警告次数映射到具体命令,因此团队只需在配置文件中写明“三次警告即封禁一天”,而不必依赖在线管理员的记忆。
设置
/serversystem setup
列出新服务器仍需完成的事项清单,其中缺失的步骤均可点击跳转。
/serversystem doctor
检查数据库、Vault、PlaceholderAPI、出生点、可能冲突的插件、翻译缺失项以及本版本新增的设置。
权限
serversystem.player 默认开启,涵盖日常命令。serversystem.staff 和 serversystem.admin 默认对应管理员权限。每个命令也拥有独立的节点,因此可以单独拆分使用。
Home 的数量限制来源于权限,而非配置文件中的组列表:serversystem.homes.<数字>,优先级以最高者为准,serversystem.homes.unlimited 可覆盖所有限制。如果某个权限等级(Rank)已在 LuckPerms 中存在,则无需在此处再次定义。
配置
无需任何修改。全新服务器只需安装该 jar 文件,保持所有文件原样即可。
有五个项目会放入 plugins/ServerSystem 目录中:
| 文件 |
包含内容 |
config.yml |
各项设置,每项均带有内联注释 |
commands.yml |
每个命令对应一个条目,共计 133 个 |
kits.yml |
预设套装,以可读格式保存或通过 /createkit 命令捕获生成 |
worth.yml |
每种物品的出售价格 |
lang/ |
每种语言对应一个文件 |
config.yml 包含以下内容:
| 部分 |
决定内容 |
language(语言) |
默认语言,以及是否跟随每位玩家的客户端设置 |
storage(存储) |
SQLite 或 MySQL,以及保存频率 |
economy(经济) |
货币符号、小数位数、初始余额、最低与最高限额、Vault 集成、交易日志 |
teleport(传送) |
引导时间、冷却时间、移动或受到伤害时是否取消传送、安全目的地 |
homes(家)、warps(传送点)、spawn(出生点) |
家的数量上限、每个传送点的权限、各世界出生点、重生行为 |
chat(聊天) |
消息格式、命令间谍功能、静音会阻止哪些命令、离线消息作为邮件处理 |
nickname(昵称) |
长度限制、前缀、标签页列表是否随之更改 |
moderation(管理)、warnings(警告)、jail(监禁) |
默认理由、广播提示、达到 N 次警告时的自动操作、监禁范围 |
afk(空闲)、vanish(隐身) |
空闲超时时间、踢出计时器、隐身模式具体隐藏的内容 |
每个命令的条目如下所示,enabled: false 表示该命令根本不会被注册:
give:
enabled: true
aliases: []
permission: serversystem.command.give
cooldown: 0
cost: 0.0
占位符
安装 PlaceholderAPI 后:
| 占位符 |
显示内容 |
%serversystem_balance% |
原始余额 |
%serversystem_balance_formatted% |
带货币符号的余额 |
%serversystem_balance_compact% |
以 1.23M 格式显示的余额 |
%serversystem_nickname% |
昵称,或账户名称 |
%serversystem_homes% / %serversystem_homes_max% |
已使用的主页数量及允许的最大数量 |
%serversystem_playtime% / %serversystem_playtime_hours% |
游戏时长 |
%serversystem_afk% %serversystem_vanished% %serversystem_god% %serversystem_flying% %serversystem_jailed% |
状态 |
%serversystem_language% |
玩家阅读所使用的语言 |
%serversystem_mail_unread% |
未读消息数量 |
%serversystem_warps% |
传送点的总数 |
支持
问题、错误报告及翻译:dc.gg/paperstream
遵循 GPL-3.0 许可证。
ServerSystem
Homes, warps, teleports, kits, money and moderation. 133 commands, every one of them switchable, and a way in and out of EssentialsX.
Essentials is the plugin almost every server installs first and almost nobody is happy with. It works, and it has worked since 2011, which is also the problem: one YAML file per player, a /give you cannot turn off without renaming it, and no idea what Folia is.
ServerSystem is the same job done with the last decade in mind. Player data lives in a database. Every command can be switched off individually. Every player reads in their own language. And if you decide it was a mistake, one command writes everything back out in Essentials' own format.
Requirements
- Paper 1.21.x or newer, or a fork of it (Purpur, Pufferfish, Leaves)
- Folia works, the whole plugin uses the region scheduler
- Java 21
- Vault - optional, only so other plugins can see the economy
- PlaceholderAPI - optional, only if you want the placeholders
On first start Paper downloads HikariCP and the database drivers by itself. That is why the jar is half a megabyte instead of twenty.
EssentialsX migration
/serversystem migrate here --dry-run
/serversystem migrate here
The dry run reads everything and tells you what it found without writing anything. It carries over balances, homes, warps, spawns, jails, kits, worth prices, nicknames, ignore lists, mail, active mutes and the vanilla ban list Essentials shares.
Your Essentials folder is not touched. Nothing is deleted on either side, and running the import twice updates the same rows rather than doubling them, so you can import, look around, and import again after fixing something.
What has no equivalent is reported rather than dropped in silence. Numeric item ids from 1.12 kits cannot be resolved on a modern server, and a home in a world that is no longer loaded cannot be checked, so both are named in the report instead of being guessed at.
Exporting back
/serversystem migrate to essentials
/serversystem migrate to essentials --apply
The first writes a complete Essentials data folder into plugins/ServerSystem/essentials-export. The second writes it straight into plugins/Essentials, after copying whatever is there into a timestamped backup.
This is not there because anybody should want to go back. It is there because a server that cannot leave a plugin has not chosen it.
Switchable commands
commands.yml has one entry per command:
give:
enabled: true
aliases: []
permission: serversystem.command.give
cooldown: 0
cost: 0.0
enabled: false does not hide the command or refuse it - it is never registered with the server at all. It disappears from /help and from tab completion, and the name is free for another plugin to claim. That is the part Essentials cannot do: a command it owns stays owned.
Commands are registered at runtime rather than listed in plugin.yml, which is what makes all of that configuration instead of a jar edit. Names that vanilla already owns, such as /give and /tp, are taken over on purpose. Names another plugin owns are left alone and reported in the console, unless you list them under override-commands in config.yml.
A command added by a later version appends itself to the bottom of the file with its defaults. Nothing you changed is ever rewritten, and comments you add stay.
Storage
Essentials keeps one YAML file per player. On a server with thirty thousand of them, /baltop means opening thirty thousand files, and it does it on the server thread.
Here everything is one table. Online players are held in memory, so no command waits for a query. Offline lookups hit the database once and stay cached for five minutes, which is what makes /balance SomeoneWhoLeftLastYear finish instantly. /baltop is one ORDER BY, so it costs the same whether a hundred players exist or a hundred thousand.
SQLite by default and no setup at all. MySQL when several servers should share balances, homes and punishments.
Money
Balances are BigDecimal, not double. A double is fine until a server has been trading for a few months and a shop plugin quietly rounds a payout, and by then the only evidence is a player insisting they were short-changed.
Every change is recorded: how much, what it left behind, who did it and why. So "where did my money go" has an answer that does not depend on anybody's memory.
ServerSystem registers itself with Vault, so shops, jobs and crate plugins talk to it the way they already expect. A purchase made through a shop is logged exactly like one made with /pay.
Languages
Players are served in the language their Minecraft client is set to. A Spanish player reads Spanish on a German server without anybody configuring anything, and /language overrides it for anyone whose client language is not the one they want to read.
Missing lines fall back per line, not per file, so a half-finished translation is usable rather than a wall of blank text. English, German and French are included. Drop another file into plugins/ServerSystem/lang and it appears in /language on the next reload.
Teleporting
One place decides the warmup, the cooldown, whether moving cancels it, and whether the destination is somewhere a player can survive. Doing that per command is how plugins end up with a /home that respects the warmup and a /warp that does not.
Destinations are checked before the player is moved. A home in a room somebody filled with lava is refused rather than being a death sentence, because coordinates do not stay safe.
Teleports are asynchronous, which is a requirement on Folia and a courtesy on Paper: the destination chunk loads off the tick instead of stalling it.
Moderation
Nothing is deleted. Lifting a ban marks the row inactive and records who lifted it, so a staff team can see that a player was banned three times and unbanned by the same person each time.
Bans are recorded against the account, not the name, so a rename does not lift one. The login check runs on the async pre-login event, before the server has built a player object, and is a single indexed query rather than a walk over a banlist file.
Warnings can act on themselves. warnings.actions in config.yml maps a count to a command, so a team that agrees "three warnings is a day ban" writes that down once instead of relying on whichever moderator is online to remember it.
Setup
/serversystem setup
A checklist of what a new server still needs, with the missing steps clickable.
/serversystem doctor
Checks the database, Vault, PlaceholderAPI, the spawn point, plugins that would conflict, translation gaps and settings that are new in this version.
Permissions
serversystem.player is on by default and covers the everyday commands. serversystem.staff and serversystem.admin default to operators. Every command also has its own node, so any of it can be split apart.
Home limits come from permissions rather than a group list in the config: serversystem.homes.<number>, highest wins, serversystem.homes.unlimited beats all of them. A rank that already exists in LuckPerms does not have to be described a second time here.
Configuration
Nothing has to be touched. A brand new server can install the jar and leave every file alone.
Five things land in plugins/ServerSystem:
| File |
Holds |
config.yml |
every setting, each one commented in place |
commands.yml |
one entry per command, all 133 of them |
kits.yml |
the kits, in a readable format or captured with /createkit |
worth.yml |
what each item sells for |
lang/ |
one file per language |
What config.yml covers:
| Section |
Decides |
language |
the default language, and whether to follow each player's client |
storage |
SQLite or MySQL, and how often to save |
economy |
symbol, decimals, starting balance, floor and ceiling, Vault, transaction log |
teleport |
warmup, cooldown, whether moving or taking damage cancels, safe destinations |
homes warps spawn |
home limit, per-warp permissions, per-world spawns, respawn behaviour |
chat |
message format, command spy, which commands a mute blocks, offline messages as mail |
nickname |
length, prefix, whether the tab list changes too |
moderation warnings jail |
default reasons, broadcasts, automatic action at N warnings, jail radius |
afk vanish |
idle timeout, kick timer, what vanish actually hides |
Each command's entry looks like this, and enabled: false means the command is never registered at all:
give:
enabled: true
aliases: []
permission: serversystem.command.give
cooldown: 0
cost: 0.0
Placeholders
With PlaceholderAPI installed:
| Placeholder |
Shows |
%serversystem_balance% |
the raw balance |
%serversystem_balance_formatted% |
the balance with the currency symbol |
%serversystem_balance_compact% |
the balance as 1.23M |
%serversystem_nickname% |
nickname, or the account name |
%serversystem_homes% / %serversystem_homes_max% |
homes used and allowed |
%serversystem_playtime% / %serversystem_playtime_hours% |
time played |
%serversystem_afk% %serversystem_vanished% %serversystem_god% %serversystem_flying% %serversystem_jailed% |
state |
%serversystem_language% |
the language this player reads in |
%serversystem_mail_unread% |
unread messages |
%serversystem_warps% |
how many warps exist |
Support
Questions, bug reports and translations: dc.gg/paperstream
Licensed under GPL-3.0.
评论 0
登录后参与评分
还没有评论,来抢沙发吧