mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-20 07:29:27 +00:00
Fix possible error is crop config has been changed
This commit is contained in:
@@ -416,9 +416,15 @@ public class CropBlock extends AbstractCustomCropsBlock {
|
|||||||
if (ConfigManager.doubleCheck()) {
|
if (ConfigManager.doubleCheck()) {
|
||||||
plugin.getScheduler().sync().run(() -> {
|
plugin.getScheduler().sync().run(() -> {
|
||||||
CropStageConfig nearest = config.stageWithModelByPoint(previousPoint);
|
CropStageConfig nearest = config.stageWithModelByPoint(previousPoint);
|
||||||
String blockID = plugin.getItemManager().id(location.toLocation(bukkitWorld), nearest.existenceForm());
|
if (nearest != null) {
|
||||||
if (!config.stageIDs().contains(blockID)) {
|
String blockID = plugin.getItemManager().id(location.toLocation(bukkitWorld), nearest.existenceForm());
|
||||||
plugin.getPluginLogger().warn("Crop[" + config.id() + "] is removed at location[" + world.worldName() + "," + location + "] because the id of the block is [" + blockID + "]");
|
if (!config.stageIDs().contains(blockID)) {
|
||||||
|
plugin.getPluginLogger().warn("Crop[" + config.id() + "] is removed at location[" + world.worldName() + "," + location + "] because the id of the block is [" + blockID + "]");
|
||||||
|
world.removeBlockState(location);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
plugin.getPluginLogger().warn("Crop[" + config.id() + "] is removed at location[" + world.worldName() + "," + location + "] because no model found for point[" + previousPoint + "]");
|
||||||
world.removeBlockState(location);
|
world.removeBlockState(location);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user