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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user