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

fix issue caused by corrupted event

This commit is contained in:
XiaoMoMi
2024-08-29 22:49:09 +08:00
parent 189efa37c1
commit 3cbd1f65a6
2 changed files with 7 additions and 8 deletions

View File

@@ -86,7 +86,8 @@ public abstract class AbstractCustomListener implements Listener {
Material.TWISTING_VINES,
Material.WEEPING_VINES,
Material.KELP,
Material.CACTUS
Material.CACTUS,
Material.AIR
)
);
if (VersionManager.isHigherThan1_19()) {
@@ -164,14 +165,12 @@ public abstract class AbstractCustomListener implements Listener {
public void onPlaceBlock(BlockPlaceEvent event) {
final Block block = event.getBlock();
final Location location = block.getLocation();
if (CUSTOM_MATERIAL.contains(block.getType())) {
return;
}
Optional<CustomCropsBlock> customCropsBlock = CustomCropsPlugin.get().getWorldManager().getBlockAt(SimpleLocation.of(location));
if (customCropsBlock.isPresent()) {
if (customCropsBlock.get() instanceof WorldPot || customCropsBlock.get() instanceof WorldGlass) {
CustomCropsPlugin.get().getWorldManager().removeAnythingAt(SimpleLocation.of(location));
} else {
event.setCancelled(true);
return;
}
CustomCropsPlugin.get().getWorldManager().removeAnythingAt(SimpleLocation.of(location));
}
this.onPlaceBlock(
event.getPlayer(),

View File

@@ -8,7 +8,7 @@ plugins {
allprojects {
project.group = "net.momirealms"
project.version = "3.5.10"
project.version = "3.5.11"
apply<JavaPlugin>()
apply(plugin = "java")