Repository navigation
FakePlayer-CE.Build20
·
26 commits
to master
since this release
FakePlayer-CE.Build20
Renaming, MySQL, a new HTTP stack, and three behaviours that were quietly wrong
This build adds a long-requested command and replaces two pieces of infrastructure, but the more useful part is probably the fixes: a feature that never targeted what it claimed to, an exception that used to break other plugins, and two leftovers from build 19's permission/cleanup work.
Highlights
- New
/fp rename <name> <new-name> [force](#39). A fake player's name is bound to its UUID, so renaming really is "re-spawn under a new UUID": it goes offline, its inventory, advancements, stats and skin move to the new UUID, and it comes back at the same spot with the same lifespan and creator. If the target name is already in use, the command refuses —force(permissionfakeplayer.command.rename.force) hands the name over. - New
/fp autosleep on|off [name]. A fake player with it enabled walks into a free bed on its own during the night instead of standing awake until morning;/fp sleepstill sleeps once and/fp wakeupstill wakes. Overworld only, and it needs an unoccupied bed within 4 blocks. - MySQL support, and a command to migrate existing data. Setting
database.type: mysqland filling in the newdatabase.mysqlblock stores passwords, UUID mappings, skins and personal configs in MySQL instead of the localdata.db;/fp migrate-dbcopies an existing SQLite file over once, so switching loses nothing. - The HTTP admin API runs on Undertow. The JDK's built-in HTTP server cannot limit request sizes or idle connections, keeps no keep-alive budget and shuts down abruptly. The API now caps a request URI at 4 KB, reclaims idle connections after 30 seconds and stops gracefully on disable. Paths, authentication and rate limits are unchanged.
Critical Fixes
- "Look at nearby entities" now looks at the nearest entity (upstream #129). The distance tracker started at
0and was only updated after the first candidate, so the comparison never matched and the fake player kept facing whichever entity the server listed first — frequently itself, since the area query is centred on its own position. It now skips itself, compares from a real starting distance, and aims at a living target's eyes instead of its feet. - A fake player no longer breaks other plugins' plugin messages. Our packet handler is invoked from inside
Player#sendPluginMessage, so anything it threw aborted the caller's own task — PlayerPoints reverted point transactions this way whenDiscardedPayload#data()was missing on a non-Paper fork. Failures are now contained and logged at most once a minute per cause. - Fixed command help always using the server's language (#142). Command descriptions were translated once at startup with
i18n.locale, so every help page stayed in the server language even for a Chinese client. They are sent as translatable text now and follow the client locale. - Fixed the login-plugin exemption surviving a removed fake player (#143). When the creator had already been cleaned up, the after-quit step was skipped entirely, so an AuthMe / LibreLogin exemption could stay behind for the rest of the session.
Breaking Changes
- None in behaviour.
config.ymlis now version 35 because of the newdatabasesection; existing files upgrade automatically on start. Changingdatabase.typeneeds a restart, since the data source is built at enable time.
Important Notes
- Renaming changes the fake player's UUID. Player data, skin records and the name binding are migrated, but anything outside the world folder that remembered the old UUID (external plugin databases, scoreboard entries, whitelists) will not follow.
- The jar is now about 11 MB instead of 2.6 MB. Undertow (with xnio and jboss-logging) and the MySQL driver are bundled, because servers do not ship them.
/fp renameand the bungee-cord forwarding are the only areas that touch NMS here. No newconfig.ymloptions are involved.
Usage
- Java: 25+ (required)
- Server: Paper / Leaf / Purpur 1.20.1+ (Folia supported)
- API: CommandAPI 12.0.0+ (Minecraft 26.3 requires 12.1.0+)
- Optional: SkinsRestorer (premium skins), AuthMe / CatSeedLogin / LibreLogin (login-plugin exemption), PlaceholderAPI
Credits
- CE maintenance: @EndlessPixel
- @lldxlzy (issues #142 and #143: help-page locale, login exemption cleanup)
- @TWJohnJohn20116 (#39:
/fp rename) - xiplugin/FakePlayerPlus for the rename implementation this was ported from (PR #39 there)
- Upstream reports in tanyaofei/minecraft-fakeplayer that led to two of the fixes: #129 (look at nearby entities) and #135 (PlayerPoints / plugin-message conflict)
FakePlayer-CE.Build20 —— 重命名、MySQL、新的 HTTP 层,外加三个一直错得很安静的地方
这个版本加了呼声很高的命令,也换掉了两处基础设施;但真正有用的大概是那几个修复:一个从没指向它所声称目标的特性、一个会打断其他插件的异常,以及 build 19 那次权限/清理改动留下的两处尾巴。
核心特性
- 新增
/fp rename <名称> <新名称> [force](#39)。 假人的名字和 UUID 绑定,所以重命名本质上是「换 UUID 重新召唤」:先下线,把背包、成就、统计与皮肤迁到新 UUID 下,再按原位置、原寿命、原创建者重新召唤。目标名称已被占用时默认拒绝,加force(权限fakeplayer.command.rename.force)才会接管该名称。 - 新增
/fp autosleep on|off [假人]。 开启后假人夜里会自己找空床躺下,不再整夜站着;/fp sleep仍是睡一次,/fp wakeup仍是叫醒。仅主世界生效,且 4 格内要有没被占用的床。 - 支持 MySQL,并附带数据迁移命令。 把
database.type设为mysql并填好新增的database.mysql段后,密码、UUID 映射、皮肤与个人配置改存 MySQL(默认仍是插件目录下的data.db);/fp migrate-db可把已有的 SQLite 数据一次性搬过去,换库不丢数据。 - HTTP 管理接口改用 Undertow。 JDK 自带的 HTTP 服务器无法限制请求体与空闲连接,也没有平滑关闭;现在单请求 URI 上限 4 KB、空闲连接 30 秒回收、插件停用/重启时优雅关闭。路径、鉴权与限流规则完全不变。
关键修复
- 「看向附近实体」现在真的会看向最近的那个(上游 #129)。 距离变量的初始值是
0且只在第一个候选之后才更新,比较永远不成立,假人实际一直盯着服务器先返回的那个实体 —— 而查询以自身为圆心,第一个往往是它自己。现在会排除自己、用正确的初始距离比较,并看向活体实体的眼睛而不是脚底。 - 假人不再打断其他插件的插件消息。 我们的发包重写跑在
Player#sendPluginMessage的调用栈里,一旦抛异常,调用方自己的任务就会中断 —— 在缺少DiscardedPayload#data()的非 Paper 系核心上,PlayerPoints 的点券交易正是这样被回滚的。现在异常会被吞掉,同类错误每分钟最多记一条日志。 - 修复命令帮助的语言不跟随玩家(#142)。 命令说明原先在启动时按
i18n.locale一次性翻译成写死的文本,客户端是中文也只会显示服务器语言。现在这些说明按可翻译文本下发,跟随客户端语言。 - 修复假人被移除后登录插件豁免残留(#143)。 创建者已被先行清理时,退出后的收尾步骤会被整段跳过,AuthMe / LibreLogin 的豁免标记可能一直留到关服。
破坏性变更
- 行为上没有。 由于新增了
database段,config.yml版本提升至 35;现有配置文件启动时自动升级。修改database.type需要重启,因为数据源在启用时构造。
重要说明
- 重命名会换掉假人的 UUID。 玩家数据、皮肤记录与名称绑定都会迁移,但世界目录之外记住旧 UUID 的东西(其他插件的数据库、计分板条目、白名单)不会跟着变。
- 产物体积从约 2.6 MB 涨到约 11 MB。 因为打包了 Undertow(含 xnio、jboss-logging)与 MySQL 驱动 —— 服务端本身不带这些。
- 这次只有
/fp rename与 BungeeCord 消息转发会碰到 NMS 层。 没有新增任何config.yml选项。
使用要求
- Java:25+(必需)
- 服务端:Paper / Leaf / Purpur 1.20.1+(支持 Folia)
- API:CommandAPI 12.0.0+(Minecraft 26.3 需要 12.1.0+)
- 可选:SkinsRestorer(正版皮肤)、AuthMe / CatSeedLogin / LibreLogin(登录插件豁免)、PlaceholderAPI
鸣谢
- CE 维护:@EndlessPixel
- @lldxlzy(issue #142、#143:帮助页语言、登录豁免清理)
- @TWJohnJohn20116(#39:
/fp rename) - xiplugin/FakePlayerPlus(
/fp rename的实现移植自该项目 PR #39) - tanyaofei/minecraft-fakeplayer 的两个上游报告促成了本次两个修复:#129(看向附近实体)、#135(PlayerPoints / 插件消息冲突)