[Bug] ProxySupport 用相对路径读 paper-global.yml, 从非服务器目录启动时 Velocity 漏判
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Read ProxySupport.java, especially isVelocityForwarding(), and check how Bukkit.getWorldContainer() identifies the server directory. Confirm the relative paths fail when the JVM starts outside that directory, then adjust the paths and verify Velocity forwarding is detected in that case. Done when the configuration is found from an external working directory and the existing forwarding detection still works.
Written by the indexing model from the issue text.
Description
检查清单
- 我已检索现有 Issues 和 PR,确认该 Bug 尚未被提交或修复
- 我确认当前服务端环境满足插件运行要求
- 如有日志,我会附上错误日志以方便排查
插件版本
fp.build22(未发布)
构建 commit
a64bc655
MC 服务端版本
26.3
服务端核心
Paper / Purpur
Bug 描述
ProxySupport.isVelocityForwarding()(ProxySupport.java:53)用相对路径读配置文件:
for (var path : new String[] {"config/paper-global.yml", "paper.yml"}) {
var file = new File(path);
这两个路径相对的是 JVM 的当前工作目录,不是服务器目录。服务端从自身目录之外启动时(systemd 没写 WorkingDirectory=、面板 / 包装脚本、java -jar /srv/mc/paper.jar 这类写法),file.isFile() 直接是 false,Velocity 现代转发就漏判了;而 isLegacyBungee() 走 Bukkit.getServer().spigot() 读的是内存配置,不受影响,所以漏的正好是 Velocity 这一半。
后果落在 WildFakeplayerManager:IS_PROXIED 是 static final(WildFakeplayerManager.java:32),漏判后被固化成 false,于是 cleanup 走第 155 行的分支,只按本服在线名单立即清理,不看其他子服。玩家跨服离开这台服务器,他名下的假人就会被删掉——正是 ProxySupport 类注释第 16-19 行自己列出的那个漏判后果。
复现步骤
- 服务器装在
/srv/mc,/srv/mc/config/paper-global.yml里proxies.velocity.enabled: true - 从别的目录启动:
cd / && java -jar /srv/mc/purpur.jar - 玩家 A 在这台子服召唤假人,然后切到另一台子服
- 等到下一次
CLEANUP_PERIOD(6000 tick)→ A 的假人被清理
相对路径这一层可以脱离服务端直接验证:
user.dir = /tmp/cwdtest
new File("config/paper-global.yml").isFile() = false
(同一个 JVM,cd 进 /tmp/cwdtest/srv 之后 = true)
建议
拼 Bukkit.getWorldContainer() 而不是裸相对路径,读取逻辑本身不用动。
日志
无报错,属于漏判后的行为问题。
性能问题请附 sysinfo
非性能问题,留空。
- Dominant language
- Java
- Stars
- 50
- Forks
- 10
- Avg merge
- 1h 40m
- Merged PRs (30d)
- 39
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from EndlessPixel-Studio/FakePlayer-CE
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
EndlessPixel-Studio/FakePlayer-CE#154 ·
Maintainers usually reply within 1 day
-
config enhancement help wanted
Difficulty 5/5 Over a week Newbie friendliness 25/100
EndlessPixel-Studio/FakePlayer-CE#148 ·
Maintainers usually reply within 1 day
-
api blocked compat core dist nms priority-high
Difficulty 5/5 Over a week Newbie friendliness 25/100
EndlessPixel-Studio/FakePlayer-CE#133 · 1 comment ·
Maintainers usually reply within 1 day
All issues in EndlessPixel-Studio/FakePlayer-CE
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
PCL-Community/PCL-CE#3907 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 2 days
-
area/dependencies area/dependencies/quarkus backport/26.6 backport/26.8 kind/cve severity/critical source/scan-dependencies status/triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
docker-to-squash.py: check_dependencies should find mksquashfs on PATHPossibly taken @linzch3 claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
chore
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
lugassawan/swe-workbench#841 ·