9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-28 03:19:15 +00:00
This commit is contained in:
XiaoMoMi
2024-08-24 16:42:53 +08:00
parent a5ebf3102d
commit 189efa37c1
2 changed files with 9 additions and 2 deletions

View File

@@ -28,6 +28,8 @@ import net.momirealms.customcrops.api.mechanic.requirement.State;
import net.momirealms.customcrops.api.mechanic.world.CustomCropsBlock;
import net.momirealms.customcrops.api.mechanic.world.SimpleLocation;
import net.momirealms.customcrops.api.mechanic.world.level.WorldCrop;
import net.momirealms.customcrops.api.mechanic.world.level.WorldGlass;
import net.momirealms.customcrops.api.mechanic.world.level.WorldPot;
import net.momirealms.customcrops.api.util.EventUtils;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -164,7 +166,12 @@ public abstract class AbstractCustomListener implements Listener {
final Location location = block.getLocation();
Optional<CustomCropsBlock> customCropsBlock = CustomCropsPlugin.get().getWorldManager().getBlockAt(SimpleLocation.of(location));
if (customCropsBlock.isPresent()) {
CustomCropsPlugin.get().getWorldManager().removeAnythingAt(SimpleLocation.of(location));
if (customCropsBlock.get() instanceof WorldPot || customCropsBlock.get() instanceof WorldGlass) {
CustomCropsPlugin.get().getWorldManager().removeAnythingAt(SimpleLocation.of(location));
} else {
event.setCancelled(true);
return;
}
}
this.onPlaceBlock(
event.getPlayer(),