第124批续28: clearAll 时清光标物品组件(彻底交还原版堆叠)
Auto Release / build (push) Successful in 2m31s

rescanOnlinePlayers 扫背包槽后, 对玩家 getOpenInventory().getCursor() 也 unsetData 清除自定义 max_stack_size 组件。
此前只扫背包槽+容器, 拖在光标上的物品(如从48蛋拖出的14蛋)带 max=64 组件, clearAll 没清 →
14+2=16 受 64 约束无法合并到 16(原版上限)。现在 clearAll 时清光标, 主背包/容器场景都覆盖。
This commit is contained in:
youpaishidifu
2026-11-18 18:46:37 +08:00
parent 93f5ebea31
commit 4053a239ee
@@ -458,6 +458,23 @@ public class StackConfigManager implements Listener {
} catch (Exception ignored) { } catch (Exception ignored) {
// 玩家瞬间下线/关闭容器,忽略单次失败 // 玩家瞬间下线/关闭容器,忽略单次失败
} }
// ★ 续28(2026-11-18):0信任 clearAll 时,对玩家【光标物品】也 unsetData。
// 此前只扫背包槽+容器,拖在光标上的物品(如从48蛋拖出的14蛋)带 max=64 组件,
// clearAll 没清 → 14+2=16 受 64 约束无法合并到 16(原版上限)。
// 现在 clearAll 时清光标,玩家像原版一样堆叠。放在容器分支外,主背包场景也覆盖。
try {
InventoryView view = p.getOpenInventory();
if (view != null) {
ItemStack cursor = view.getCursor();
if (cursor != null && cursor.getType() != Material.AIR) {
int cfgMax = getMaxStackSize(cursor.getType());
if (cfgMax <= 0) {
cursor.unsetData(io.papermc.paper.datacomponent.DataComponentTypes.MAX_STACK_SIZE);
view.setCursor(cursor);
}
}
}
} catch (Exception ignored) {}
} catch (Exception e) { } catch (Exception e) {
plugin.getLogger().warning("[物品堆叠] 补扫玩家 " + p.getName() + " 失败: " + e.getMessage()); plugin.getLogger().warning("[物品堆叠] 补扫玩家 " + p.getName() + " 失败: " + e.getMessage());
} }