From 8940c8be8d04073e4813a3fca624f046b394d909 Mon Sep 17 00:00:00 2001 From: mlus-Asuka <1319237806@qq.com> Date: Fri, 31 Mar 2023 13:18:36 +0800 Subject: [PATCH] fix curios bugs. --- .../fubuki/playersync/sync/ModsSupport.java | 25 +++++++++++-------- src/main/resources/META-INF/mods.toml | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/java/vip/fubuki/playersync/sync/ModsSupport.java b/src/main/java/vip/fubuki/playersync/sync/ModsSupport.java index 7b7f4a7..930985f 100644 --- a/src/main/java/vip/fubuki/playersync/sync/ModsSupport.java +++ b/src/main/java/vip/fubuki/playersync/sync/ModsSupport.java @@ -25,18 +25,21 @@ public class ModsSupport { LazyOptional itemHandler = CuriosApi.getCuriosHelper().getEquippedCurios(player); ResultSet resultSet = JDBCsetUp.executeQuery("SELECT curios_item FROM curios WHERE uuid = '"+player.getUUID()+"'"); if(resultSet.next()) { - Map curios = LocalJsonUtil.StringToEntryMap(resultSet.getString("curios_item")); - itemHandler.ifPresent(handler -> { - for (int i = 0; i < handler.getSlots(); i++) { - try { - if(curios.get(i)==null) continue; - handler.setStackInSlot(i, ItemStack.of(NbtUtils.snbtToStructure(curios.get(i).replace("|", ",")))); - } catch (CommandSyntaxException e) { - throw new RuntimeException(e); + String curios_data=resultSet.getString("curios_item"); + if(curios_data.length()>2) { + Map curios = LocalJsonUtil.StringToEntryMap(curios_data); + itemHandler.ifPresent(handler -> { + for (int i = 0; i < handler.getSlots(); i++) { + try { + if (curios.get(i) == null) continue; + handler.setStackInSlot(i, ItemStack.of(NbtUtils.snbtToStructure(curios.get(i).replace("|", ",")))); + } catch (CommandSyntaxException e) { + throw new RuntimeException(e); + } } - } - }); - resultSet.close(); + }); + } + resultSet.close(); }else{ StoreCurios(player,true); } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 43c1650..8218fe6 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -19,7 +19,7 @@ modId="playersync" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata # see the associated build.gradle script for how to populate this completely automatically during a build -version="1.1.2" #mandatory +version="1.1.3" #mandatory # A display name for the mod displayName="PlayerSync" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/