9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-28 19:39:20 +00:00

3.2.2-hotfix

This commit is contained in:
Xiao-MoMi
2023-05-19 19:15:49 +08:00
parent 2994689bcf
commit f8da51210b
4 changed files with 15 additions and 11 deletions

View File

@@ -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) {

View File

@@ -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<File> 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<ChunkCoordinate, CCChunk> entry : chunkMap.entrySet()) {
ChunkCoordinate chunkCoordinate = entry.getKey();
CCChunk chunk = entry.getValue();