9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-20 15:39:21 +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.TWISTING_VINES,
Material.WEEPING_VINES, Material.WEEPING_VINES,
Material.KELP, Material.KELP,
Material.CACTUS Material.CACTUS,
Material.AIR
) )
); );
if (VersionManager.isHigherThan1_19()) { if (VersionManager.isHigherThan1_19()) {
@@ -164,14 +165,12 @@ public abstract class AbstractCustomListener implements Listener {
public void onPlaceBlock(BlockPlaceEvent event) { public void onPlaceBlock(BlockPlaceEvent event) {
final Block block = event.getBlock(); final Block block = event.getBlock();
final Location location = block.getLocation(); final Location location = block.getLocation();
if (CUSTOM_MATERIAL.contains(block.getType())) {
return;
}
Optional<CustomCropsBlock> customCropsBlock = CustomCropsPlugin.get().getWorldManager().getBlockAt(SimpleLocation.of(location)); Optional<CustomCropsBlock> customCropsBlock = CustomCropsPlugin.get().getWorldManager().getBlockAt(SimpleLocation.of(location));
if (customCropsBlock.isPresent()) { if (customCropsBlock.isPresent()) {
if (customCropsBlock.get() instanceof WorldPot || customCropsBlock.get() instanceof WorldGlass) { CustomCropsPlugin.get().getWorldManager().removeAnythingAt(SimpleLocation.of(location));
CustomCropsPlugin.get().getWorldManager().removeAnythingAt(SimpleLocation.of(location));
} else {
event.setCancelled(true);
return;
}
} }
this.onPlaceBlock( this.onPlaceBlock(
event.getPlayer(), event.getPlayer(),

View File

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