根因(生产服日志实锤):checkWorldEmptyAndDelete 删除某PVP世界时, 若 inPVPArena 仍有登记,旧代码直接 inPVPArena.clear() 全量清空。 当「删的是A世界、玩家正站在B世界」时,活跃玩家被误清 → 随后 /pvp leave 走 forceLeaveArena 因 inPVPArena 无登记而提前 return → 背包还原/装备回收不执行 → PVP装备带出主城(触发残骸裹身成就)+ 原背包未还原(空白背包)。偶然触发:仅在前一退出者删的世界恰好空、 且另有玩家站在【另一个】PVP世界时复现。 修复:幽灵登记清理改为逐条校验实际世界——只清「已下线或不在任何 PVP世界」的残留;正站在某PVP世界里的活跃玩家保留。
This commit is contained in:
@@ -1296,10 +1296,33 @@ public class PVPArenaManager implements Listener {
|
||||
}
|
||||
// ★ 公共世界已空但登记表还有人 → 说明是断线漏清理的"幽灵在场",顺手清掉,
|
||||
// 否则下次 /pvp join 会误判"已有其他玩家在场"而复用一个空局。
|
||||
// ★ 第123批续18:逐个校验而非全量 clear —— 旧实现在删除某个 PVP 世界时
|
||||
// 把 inPVPArena 全清,会把「正站在【另一个】PVP 世界里的活跃玩家」也当成
|
||||
// 幽灵清掉 → 该玩家随后 /pvp leave 走 forceLeaveArena 时因 inPVPArena 已无
|
||||
// 登记而提前 return,背包还原/装备回收不执行 → PVP装备带出主城+背包空白。
|
||||
// 现只清「已下线 或 不在任何 PVP 世界」的残留;正站在某 PVP 世界里的玩家保留。
|
||||
if (!inPVPArena.isEmpty()) {
|
||||
List<String> ghosts = new ArrayList<>();
|
||||
List<String> active = new ArrayList<>();
|
||||
for (String reg : inPVPArena) {
|
||||
Player pl = Bukkit.getPlayerExact(reg);
|
||||
if (pl != null && pl.isOnline() && isPVPWorld(pl.getWorld())) {
|
||||
active.add(reg); // 正站在某 PVP 世界 → 不是幽灵,保留
|
||||
} else {
|
||||
ghosts.add(reg); // 已下线 / 不在 PVP 世界 → 真幽灵
|
||||
}
|
||||
}
|
||||
for (String g : ghosts) {
|
||||
inPVPArena.remove(g);
|
||||
}
|
||||
if (!ghosts.isEmpty()) {
|
||||
plugin.getLogger().warning("[PVP] ⚠ 公共世界 " + w.getName()
|
||||
+ " 已空但登记表仍有残留: " + inPVPArena + ",已清理幽灵登记");
|
||||
inPVPArena.clear();
|
||||
+ " 已空,登记表幽灵残留: " + ghosts + " 已清理"
|
||||
+ (active.isEmpty() ? "" : ";仍在 PVP 世界的活跃玩家保留: " + active));
|
||||
} else {
|
||||
plugin.getLogger().info("[PVP] 公共世界 " + w.getName()
|
||||
+ " 已空,登记表无幽灵残留(活跃玩家均在 PVP 世界: " + active + ")");
|
||||
}
|
||||
}
|
||||
plugin.getLogger().info("[PVP] PVP世界 " + w.getName()
|
||||
+ " 已无玩家,立即删除世界以释放资源(下次进入随机重生)");
|
||||
|
||||
Reference in New Issue
Block a user