From 17ad40f69308a13644f89e93e30e2b3a7d8f52c8 Mon Sep 17 00:00:00 2001 From: mlus <1319237806@qq.com> Date: Thu, 2 May 2024 16:47:08 +0800 Subject: [PATCH] code refactor --- src/main/java/vip/fubuki/playersync/sync/ModsSupport.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/vip/fubuki/playersync/sync/ModsSupport.java b/src/main/java/vip/fubuki/playersync/sync/ModsSupport.java index 7198a2f..0573c0a 100644 --- a/src/main/java/vip/fubuki/playersync/sync/ModsSupport.java +++ b/src/main/java/vip/fubuki/playersync/sync/ModsSupport.java @@ -30,11 +30,11 @@ public void onPlayerJoin(Player player) throws SQLException { if(curios_data.length()>2) { Map curios = LocalJsonUtil.StringToEntryMap(curios_data); itemHandler.ifPresent(handler -> { + handler.reset(); for (int i = 0; i < handler.getSlots(); i++) { try { - if (curios.get(i) == null){ - handler.getEquippedCurios().setStackInSlot(i,ItemStack.EMPTY); - }else{ + handler.getEquippedCurios().setStackInSlot(i,ItemStack.EMPTY); + if (curios.get(i) != null){ handler.getEquippedCurios().setStackInSlot(i, ItemStack.of(NbtUtils.snbtToStructure(curios.get(i).replace("|", ",")))); }