二手商店第七批: 修复切换出售偏好误退还物品(物品复制)——refreshPublishGui 把物品克隆进新界面后 openInventory 换视图会触发 InventoryCloseEvent,onPublishGuiClose 扫旧界面仍见物品就退了背包,而新界面还有一份克隆=双份;改为换视图前先清空旧界面,CloseEvent 扫到空界面不退。下架/超时/取消退还路径不变
This commit is contained in:
@@ -4223,6 +4223,13 @@ public class ShopManager implements Listener {
|
||||
for (int i = 0; i < 45; i++) {
|
||||
if (keep[i] != null) g.setItem(i, keep[i]);
|
||||
}
|
||||
// ★ 第七批(2026-10-12):物品已克隆进新界面,先把旧界面清空再换视图——
|
||||
// openInventory 替换视图会同步触发 InventoryCloseEvent(旧视图标题仍是发布 GUI),
|
||||
// 不清空则 onPublishGuiClose 把物品退还背包,而新界面还有一份克隆 = 物品复制
|
||||
// (玩家视角:切换偏好退了一份、发布时 GUI 里那份又上架,像退了两次)
|
||||
for (int i = 0; i < 45; i++) {
|
||||
if (old.getItem(i) != null) old.setItem(i, null);
|
||||
}
|
||||
p.openInventory(g);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user