diff --git a/build.gradle b/build.gradle index 286cdda..c13d1f9 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group = 'net.momirealms' -version = '3.2.2' +version = '3.2.2-hotfix' repositories { mavenCentral() diff --git a/src/main/java/net/momirealms/customcrops/api/customplugin/PlatformManager.java b/src/main/java/net/momirealms/customcrops/api/customplugin/PlatformManager.java index 6fae243..7615ebc 100644 --- a/src/main/java/net/momirealms/customcrops/api/customplugin/PlatformManager.java +++ b/src/main/java/net/momirealms/customcrops/api/customplugin/PlatformManager.java @@ -95,11 +95,6 @@ public class PlatformManager extends Function { public void onBreakVanillaBlock(BlockBreakEvent event) { if (event.isCancelled()) return; Block block = event.getBlock(); - if (block.getType() == Material.NOTE_BLOCK) { - SimpleLocation potLoc = SimpleLocation.getByBukkitLocation(block.getLocation()); - plugin.getWorldDataManager().removeCorrupted(potLoc); - plugin.getWorldDataManager().removePotData(potLoc); - } onBreakVanilla(event.getPlayer(), block.getLocation(), block.getType().name(), event); } @@ -182,6 +177,12 @@ public class PlatformManager extends Function { if (onBreakPot(player, id, location, event)) { return; } + + if (id.equals("NOTE_BLOCK")) { + SimpleLocation potLoc = SimpleLocation.getByBukkitLocation(location); + plugin.getWorldDataManager().removeCorrupted(potLoc); + plugin.getWorldDataManager().removePotData(potLoc); + } } public void onPlaceCustom(Player player, Location location, String id, @Nullable Cancellable event) { diff --git a/src/main/java/net/momirealms/customcrops/api/object/world/CCWorld.java b/src/main/java/net/momirealms/customcrops/api/object/world/CCWorld.java index e44620e..eff3090 100644 --- a/src/main/java/net/momirealms/customcrops/api/object/world/CCWorld.java +++ b/src/main/java/net/momirealms/customcrops/api/object/world/CCWorld.java @@ -81,11 +81,11 @@ public class CCWorld extends Function { public CCWorld(World world, CustomCrops plugin) { this.plugin = plugin; + this.worldName = world.getName(); this.chunksFolder = ConfigUtils.getFile(world, "chunks"); this.dateFile = ConfigUtils.getFile(world, "data.yml"); this.corruptedFile = ConfigUtils.getFile(world, "corrupted.yml"); this.world = new WeakReference<>(world); - this.worldName = world.getName(); this.chunkMap = new ConcurrentHashMap<>(64); this.schedule = new ScheduledThreadPoolExecutor(ConfigManager.corePoolSize); this.schedule.setMaximumPoolSize(ConfigManager.maxPoolSize); @@ -100,6 +100,7 @@ public class CCWorld extends Function { public void init() { loadDateData(); loadCorruptedPots(); + if (!chunksFolder.exists()) chunksFolder.mkdirs(); if (!ConfigManager.onlyInLoadedChunks) { loadAllChunkData(); } @@ -151,7 +152,6 @@ public class CCWorld extends Function { @SuppressWarnings("ResultOfMethodCallIgnored") public void loadAllChunkData() { - if (!chunksFolder.exists()) chunksFolder.mkdirs(); File[] data_files = chunksFolder.listFiles(); if (data_files == null) return; List outdated = new ArrayList<>(); @@ -177,6 +177,7 @@ public class CCWorld extends Function { @SuppressWarnings("ResultOfMethodCallIgnored") public void saveAllChunkData() { + if (!chunksFolder.exists()) chunksFolder.mkdirs(); for (Map.Entry entry : chunkMap.entrySet()) { ChunkCoordinate chunkCoordinate = entry.getKey(); CCChunk chunk = entry.getValue(); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 06f122b..355fc71 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -4,7 +4,7 @@ config-version: '32' metrics: true # Language: english / spanish / chinese / turkish lang: english -# debug +# Debug debug: log-scheduler: false log-corruption-fixer: false @@ -16,7 +16,7 @@ worlds: # Mode: whitelist/blacklist # Requires a restart when changing mode or editing world list for the safety of data # 模式:白名单/黑名单 - # 为了避免重载时候造成服务器卡顿,修改本栏需要重启服务器 + # 修改本栏需要重启服务器 mode: whitelist list: - world @@ -55,7 +55,9 @@ optimization: # 推荐启用区块限制来防止玩家种植大量农作物 # 如果你使用ItemsAdder的展示框模式,你需要在ItemsAdder的配置文件中设置"max-furniture-vehicles-per-chunk"到较高值,否则农作物种植后会消失 limitation: - # max crop amount per chunk + # Maximum amount of growing crops per chunk + # Note: This only limits **growing** crops + # If a crop is ripe, it would not be counted # 每个区块的限制数量 growing-crop-amount: enable: true