第33批十七次修正:小箱(≤27格)空箱根因修复——嵌套if死代码else提外层
根因实锤(生产服日志+代码分析): - L468 if(slotCount>27) 外层块内 L570 又嵌套 if(slotCount>27)(条件恒true冗余) - L612 else(单箱doBackfill) 对应 L570 的嵌套if → 死代码永不执行 - 小箱 slotCount≤27 走 L468 条件false → 整个 L469-617 块跳过 → L618 } 关闭 → 没有 doBackfill 调用 → 箱子内容从未回填 → 空箱 修复: - 移除 L570 冗余嵌套 if(slotCount>27) - 双箱实测代码块缩进去一级(28→24空格) - L612 else 提外层对应 L468 的 if/else,小箱立即 doBackfill 单箱回填 - 配平不变(open/close各减1)
This commit is contained in:
@@ -563,11 +563,8 @@ public class ChestCarryManager implements Listener {
|
||||
}
|
||||
return;
|
||||
}
|
||||
// ★ 十四次修正:双箱场景(>27格)→【立即】实测真实 size 再决定回填/回退。
|
||||
// setBlockData(LEFT)+update(true,false) 是同步的,双箱 54 格连接即时生效,
|
||||
// 立即实测即可读到真实 size;原来 2 tick 走异步线程时容器尚未同步 → 误读 27 格
|
||||
// → 误判未连成 → 走「双箱未连回退箱」寄玩家(用户看到空白箱的根因)。
|
||||
if (slotCount > 27) {
|
||||
// ★ 十七次修正:移除冗余嵌套 if (slotCount > 27)(外层 L468 已保证 >27)。
|
||||
// 直接进双箱实测块,小箱(≤27格)走外层 else 立即 doBackfill。
|
||||
int placedSize = -1;
|
||||
try {
|
||||
org.bukkit.block.BlockState stP = placedFinal.getState();
|
||||
@@ -610,12 +607,12 @@ public class ChestCarryManager implements Listener {
|
||||
+ " 需" + slotCountFinal + " 立即回填");
|
||||
doBackfill(placedFinal, data, placerUuid);
|
||||
} else {
|
||||
// 单箱场景(≤27格):立即回填(原逻辑)
|
||||
// ★ 十七次修正:单箱场景(≤27格)——立即 doBackfill 回填
|
||||
// (原 L612 死代码 else 提外层,对应 L468 的 if/else)
|
||||
plugin.getLogger().info("[箱子搬运][诊断] 单箱场景 slotCount=" + slotCount
|
||||
+ " 需" + countSlots(items0) + " 立即回填");
|
||||
doBackfill(placed, data, placerUuid);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
plugin.getLogger().fine("[箱子搬运] 接双箱异常: " + ex.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user