diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 08c6c41..b446f45 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -56,7 +56,7 @@ dependencies { compileOnly("net.kyori:adventure-text-minimessage:4.15.0") compileOnly("net.kyori:adventure-text-serializer-legacy:4.15.0") - compileOnly("de.tr7zw:item-nbt-api:2.12.2") + compileOnly("de.tr7zw:item-nbt-api:2.12.3") compileOnly("org.bstats:bstats-bukkit:3.0.2") implementation("com.flowpowered:flow-nbt:2.0.2") implementation("com.github.luben:zstd-jni:1.5.5-11") diff --git a/plugin/src/main/java/net/momirealms/customcrops/libraries/dependencies/Dependency.java b/plugin/src/main/java/net/momirealms/customcrops/libraries/dependencies/Dependency.java index 3618da9..7b9e289 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/libraries/dependencies/Dependency.java +++ b/plugin/src/main/java/net/momirealms/customcrops/libraries/dependencies/Dependency.java @@ -195,7 +195,7 @@ public enum Dependency { NBT_API( "de{}tr7zw", "item-nbt-api", - "2.12.2", + "2.12.3", "codemc", "item-nbt-api", Relocation.of("changeme", "de{}tr7zw{}changeme") diff --git a/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/adaptor/BukkitWorldAdaptor.java b/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/adaptor/BukkitWorldAdaptor.java index fc497cf..ef5569d 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/adaptor/BukkitWorldAdaptor.java +++ b/plugin/src/main/java/net/momirealms/customcrops/mechanic/world/adaptor/BukkitWorldAdaptor.java @@ -116,14 +116,16 @@ public class BukkitWorldAdaptor extends AbstractWorldAdaptor { // try converting legacy worlds if (ConfigManager.convertWorldOnLoad()) { - convertWorldFromV33toV34(cWorld, world); - return; + if (convertWorldFromV33toV34(cWorld, world)) { + return; + } } if (VersionManager.isHigherThan1_18()) { // init world basic info String json = world.getPersistentDataContainer().get(key, PersistentDataType.STRING); WorldInfoData data = (json == null || json.equals("null")) ? WorldInfoData.empty() : gson.fromJson(json, WorldInfoData.class); + if (data == null) data = WorldInfoData.empty(); cWorld.setInfoData(data); } else { File cWorldFile = new File(getWorldFolder(world), "cworld.dat"); @@ -611,7 +613,7 @@ public class BukkitWorldAdaptor extends AbstractWorldAdaptor { return outByteStream.toByteArray(); } - public void convertWorldFromV33toV34(@Nullable CWorld cWorld, World world) { + public boolean convertWorldFromV33toV34(@Nullable CWorld cWorld, World world) { // handle legacy files File leagcyFile = new File(world.getWorldFolder(), "customcrops" + File.separator + "data.yml"); if (leagcyFile.exists()) { @@ -633,10 +635,10 @@ public class BukkitWorldAdaptor extends AbstractWorldAdaptor { // read chunks File folder = new File(world.getWorldFolder(), "customcrops" + File.separator + "chunks"); - if (!folder.exists()) return; + if (!folder.exists()) return false; LogUtils.warn("Converting chunks for world " + world.getName() + " from 3.3 to 3.4... This might take some time."); File[] data_files = folder.listFiles(); - if (data_files == null) return; + if (data_files == null) return false; HashMap regionHashMap = new HashMap<>(); @@ -685,7 +687,9 @@ public class BukkitWorldAdaptor extends AbstractWorldAdaptor { saveRegion(region); } LogUtils.info("Successfully converted chunks for world: " + world.getName()); + return true; } + return false; } public void convertWorldFromV342toV343(@Nullable CWorld cWorld, World world) {