快照为空根因排查:isDone 诊断版(区分 resolveAdvancement 解析失败 vs 进度真未完成)
Auto Release / build (push) Successful in 2m30s
Auto Release / build (push) Successful in 2m30s
- 新增 isDoneDiag:resolveAdvancement 返回 null / getAdvancementProgress 返回 null / isDone=false 三种情况分别打日志(含已授/剩余 criterion 与 advancement 实际 key) - ensurePvpSnapshot 与 checkArmorAndRevokeOnJoin 改用 isDoneDiag - 生产实锤:老玩家手打成就快照为空,需定位是解析失败还是进度读取失败
This commit is contained in:
@@ -208,6 +208,35 @@ public class AchievementEffectGuard implements Listener {
|
|||||||
return prog != null && prog.isDone();
|
return prog != null && prog.isDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ★ 第124批续2:isDone 诊断版(仅快照路径调用)。
|
||||||
|
* 生产实锤:老玩家手打成就 isDone 返回 false 致快照为空,需区分
|
||||||
|
* 「resolveAdvancement 解析失败」与「进度真的未完成」。
|
||||||
|
*/
|
||||||
|
private boolean isDoneDiag(Player p, String advKey) {
|
||||||
|
Advancement adv = resolveAdvancement(advKey);
|
||||||
|
if (adv == null) {
|
||||||
|
plugin.getLogger().warning("[成就防作弊][诊断] resolveAdvancement 返回 null! key=" + advKey
|
||||||
|
+ " 玩家=" + p.getName() + " → 快照无法收录该成就");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
AdvancementProgress prog = p.getAdvancementProgress(adv);
|
||||||
|
if (prog == null) {
|
||||||
|
plugin.getLogger().warning("[成就防作弊][诊断] getAdvancementProgress 返回 null! key=" + advKey
|
||||||
|
+ " 玩家=" + p.getName());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean done = prog.isDone();
|
||||||
|
if (!done) {
|
||||||
|
plugin.getLogger().info("[成就防作弊][诊断] isDone=false key=" + advKey
|
||||||
|
+ " 玩家=" + p.getName()
|
||||||
|
+ " 已授criterion=" + prog.getAwardedCriteria()
|
||||||
|
+ " 剩余criterion=" + prog.getRemainingCriteria()
|
||||||
|
+ "(advancement 对象=" + adv.getKey() + ")");
|
||||||
|
}
|
||||||
|
return done;
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== 标记接口(供 AreaProtection 调用) ====================
|
// ==================== 标记接口(供 AreaProtection 调用) ====================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -698,7 +727,7 @@ public class AchievementEffectGuard implements Listener {
|
|||||||
inPvpWorld.add(uid);
|
inPvpWorld.add(uid);
|
||||||
Set<String> snapshot = new HashSet<>();
|
Set<String> snapshot = new HashSet<>();
|
||||||
for (String key : allGuardedKeys()) {
|
for (String key : allGuardedKeys()) {
|
||||||
if (isDone(p, key)) snapshot.add(key);
|
if (isDoneDiag(p, key)) snapshot.add(key);
|
||||||
}
|
}
|
||||||
pvpPreExisting.put(uid, snapshot);
|
pvpPreExisting.put(uid, snapshot);
|
||||||
}
|
}
|
||||||
@@ -719,7 +748,7 @@ public class AchievementEffectGuard implements Listener {
|
|||||||
inPvpWorld.add(uid);
|
inPvpWorld.add(uid);
|
||||||
Set<String> snapshot = new HashSet<>();
|
Set<String> snapshot = new HashSet<>();
|
||||||
for (String key : allGuardedKeys()) {
|
for (String key : allGuardedKeys()) {
|
||||||
if (isDone(p, key)) snapshot.add(key);
|
if (isDoneDiag(p, key)) snapshot.add(key);
|
||||||
}
|
}
|
||||||
pvpPreExisting.put(uid, snapshot);
|
pvpPreExisting.put(uid, snapshot);
|
||||||
plugin.getLogger().info("[成就防作弊] 进场快照 玩家=" + p.getName()
|
plugin.getLogger().info("[成就防作弊] 进场快照 玩家=" + p.getName()
|
||||||
|
|||||||
Reference in New Issue
Block a user