[Bug] ProxySupport 用相对路径读 paper-global.yml, 从非服务器目录启动时 Velocity 漏判

Open Beginner friendly
#155 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java
Domain
backend

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

needs-triage
检查清单
  • 我已检索现有 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 行自己列出的那个漏判后果。

复现步骤
  1. 服务器装在 /srv/mc,/srv/mc/config/paper-global.yml 里 proxies.velocity.enabled: true
  2. 从别的目录启动:cd / && java -jar /srv/mc/purpur.jar
  3. 玩家 A 在这台子服召唤假人,然后切到另一台子服
  4. 等到下一次 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EndlessPixel-Studio/FakePlayer-CE

All issues in EndlessPixel-Studio/FakePlayer-CE

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.