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

additional check

This commit is contained in:
XiaoMoMi
2024-09-08 00:50:16 +08:00
parent d4a40f5b5c
commit 6aeb341a62
6 changed files with 24 additions and 4 deletions

View File

@@ -47,6 +47,7 @@ public abstract class BukkitCustomCropsPlugin implements CustomCropsPlugin {
private static BukkitCustomCropsPlugin instance;
private final Plugin boostrap;
protected static boolean isReloading = false;
protected AbstractJavaScheduler<Location, World> scheduler;
protected DependencyManager dependencyManager;
@@ -261,4 +262,13 @@ public abstract class BukkitCustomCropsPlugin implements CustomCropsPlugin {
public File getDataFolder() {
return boostrap.getDataFolder();
}
/**
* If the plugin is currently reloading
*
* @return is reloading or not
*/
public static boolean isReloading() {
return isReloading;
}
}

View File

@@ -79,7 +79,9 @@ public class CropBlock extends AbstractCustomCropsBlock {
Location location = LocationUtils.toBlockLocation(event.location());
Pos3 pos3 = Pos3.from(location);
if (configs == null || configs.isEmpty()) {
world.removeBlockState(pos3);
if (!BukkitCustomCropsPlugin.isReloading()) {
world.removeBlockState(pos3);
}
return;
}

View File

@@ -89,7 +89,9 @@ public class PotBlock extends AbstractCustomCropsBlock {
Pos3 pos3 = Pos3.from(location);
PotConfig config = Registries.ITEM_TO_POT.get(event.brokenID());
if (config == null) {
world.removeBlockState(pos3);
if (!BukkitCustomCropsPlugin.isReloading()) {
world.removeBlockState(pos3);
}
return;
}

View File

@@ -77,7 +77,9 @@ public class SprinklerBlock extends AbstractCustomCropsBlock {
Pos3 pos3 = Pos3.from(location);
SprinklerConfig config = Registries.ITEM_TO_SPRINKLER.get(event.brokenID());
if (config == null) {
world.removeBlockState(pos3);
if (!BukkitCustomCropsPlugin.isReloading()) {
world.removeBlockState(pos3);
}
return;
}