修复老玩家手打成就被误吊销:事件key带minecraft:前缀而进场快照存短key,contains永远不命中
Auto Release / build (push) Successful in 2m50s
Auto Release / build (push) Successful in 2m50s
- grant/Done 两条装备路径读取 pvpPreExisting 前先归一化 plainKey(去 minecraft: 前缀) - ensurePvpSnapshot 加进场快照诊断日志,部署后可直接在日志核对快照内容
This commit is contained in:
@@ -356,7 +356,11 @@ public class AchievementEffectGuard implements Listener {
|
|||||||
if (!pvpPreExisting.containsKey(p.getUniqueId())) {
|
if (!pvpPreExisting.containsKey(p.getUniqueId())) {
|
||||||
ensurePvpSnapshot(p);
|
ensurePvpSnapshot(p);
|
||||||
}
|
}
|
||||||
if (pvpPreExisting.getOrDefault(p.getUniqueId(), java.util.Collections.emptySet()).contains(key)) {
|
// ★ 第124批续1:事件 key 带 minecraft: 前缀,快照存短 key,
|
||||||
|
// contains 前必须归一化——否则永远不命中,快照检查形同虚设,
|
||||||
|
// 老玩家手打成就被误撤(生产 20:51/21:39 实锤)。
|
||||||
|
String plainKey = key.startsWith("minecraft:") ? key.substring("minecraft:".length()) : key;
|
||||||
|
if (pvpPreExisting.getOrDefault(p.getUniqueId(), java.util.Collections.emptySet()).contains(plainKey)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// ★ 同成就 60 秒冷却:grant 高频(每次护甲变动都派发),
|
// ★ 同成就 60 秒冷却:grant 高频(每次护甲变动都派发),
|
||||||
@@ -453,7 +457,10 @@ public class AchievementEffectGuard implements Listener {
|
|||||||
if (!pvpPreExisting.containsKey(p.getUniqueId())) {
|
if (!pvpPreExisting.containsKey(p.getUniqueId())) {
|
||||||
ensurePvpSnapshot(p);
|
ensurePvpSnapshot(p);
|
||||||
}
|
}
|
||||||
if (pvpPreExisting.getOrDefault(p.getUniqueId(), java.util.Collections.emptySet()).contains(key)) {
|
// ★ 第124批续1:同 grant 路径,事件 key 带前缀,快照存短 key,
|
||||||
|
// contains 前先归一化,否则老玩家手打成就必被误撤。
|
||||||
|
String plainKey = key.startsWith("minecraft:") ? key.substring("minecraft:".length()) : key;
|
||||||
|
if (pvpPreExisting.getOrDefault(p.getUniqueId(), java.util.Collections.emptySet()).contains(plainKey)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!armorRevokeCooldown.add(p.getUniqueId() + ":" + key)) {
|
if (!armorRevokeCooldown.add(p.getUniqueId() + ":" + key)) {
|
||||||
@@ -715,6 +722,8 @@ public class AchievementEffectGuard implements Listener {
|
|||||||
if (isDone(p, key)) snapshot.add(key);
|
if (isDone(p, key)) snapshot.add(key);
|
||||||
}
|
}
|
||||||
pvpPreExisting.put(uid, snapshot);
|
pvpPreExisting.put(uid, snapshot);
|
||||||
|
plugin.getLogger().info("[成就防作弊] 进场快照 玩家=" + p.getName()
|
||||||
|
+ " 已有(手打)成就=" + snapshot + " 监管范围=" + allGuardedKeys());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 是否是本守卫管的三条装备成就 */
|
/** 是否是本守卫管的三条装备成就 */
|
||||||
|
|||||||
Reference in New Issue
Block a user