diff --git a/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/AbstractCustomListener.java b/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/AbstractCustomListener.java index f39f7c4..ae7871a 100644 --- a/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/AbstractCustomListener.java +++ b/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/AbstractCustomListener.java @@ -36,6 +36,7 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.Dispenser; import org.bukkit.entity.Entity; +import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; @@ -100,6 +101,18 @@ public abstract class AbstractCustomListener implements Listener { } } + @EventHandler (ignoreCancelled = true) + public void onBlockFalling(EntityChangeBlockEvent event) { + if (event.getEntity() instanceof FallingBlock fallingBlock) { + final Block block = event.getBlock(); + final Location location = block.getLocation(); + Optional customCropsBlock = CustomCropsPlugin.get().getWorldManager().getBlockAt(SimpleLocation.of(location)); + if (customCropsBlock.isPresent()) { + fallingBlock.setCancelDrop(true); + } + } + } + @EventHandler (ignoreCancelled = true) public void onInteractBlock(PlayerInteractEvent event) { if (event.getHand() != EquipmentSlot.HAND) diff --git a/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/CustomProvider.java b/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/CustomProvider.java index 95f258b..be829eb 100644 --- a/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/CustomProvider.java +++ b/api/src/main/java/net/momirealms/customcrops/api/mechanic/item/custom/CustomProvider.java @@ -69,29 +69,27 @@ public interface CustomProvider { } default CRotation removeAnythingAt(Location location) { - if (!removeBlock(location)) { - Collection entities = location.getWorld().getNearbyEntities(LocationUtils.toCenterLocation(location), 0.5,0.51,0.5); - entities.removeIf(entity -> { - EntityType type = entity.getType(); - return type != EntityType.ITEM_FRAME - && (!VersionManager.isHigherThan1_19_R3() || type != EntityType.ITEM_DISPLAY); - }); - if (entities.size() == 0) return CRotation.NONE; - CRotation previousCRotation; - Entity first = entities.stream().findFirst().get(); - if (first instanceof ItemFrame itemFrame) { - previousCRotation = CRotation.getByRotation(itemFrame.getRotation()); - } else if (VersionManager.isHigherThan1_19_R3()) { - previousCRotation = DisplayEntityUtils.getRotation(first); - } else { - previousCRotation = CRotation.NONE; - } - for (Entity entity : entities) { - removeFurniture(entity); - } - return previousCRotation; + removeBlock(location); + Collection entities = location.getWorld().getNearbyEntities(LocationUtils.toCenterLocation(location), 0.5,0.51,0.5); + entities.removeIf(entity -> { + EntityType type = entity.getType(); + return type != EntityType.ITEM_FRAME + && (!VersionManager.isHigherThan1_19_R3() || type != EntityType.ITEM_DISPLAY); + }); + if (entities.isEmpty()) return CRotation.NONE; + CRotation previousCRotation; + Entity first = entities.stream().findFirst().get(); + if (first instanceof ItemFrame itemFrame) { + previousCRotation = CRotation.getByRotation(itemFrame.getRotation()); + } else if (VersionManager.isHigherThan1_19_R3()) { + previousCRotation = DisplayEntityUtils.getRotation(first); + } else { + previousCRotation = CRotation.NONE; } - return CRotation.NONE; + for (Entity entity : entities) { + removeFurniture(entity); + } + return previousCRotation; } default String getSomethingAt(Location location) { diff --git a/build.gradle.kts b/build.gradle.kts index b90284c..ea08a3e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { allprojects { project.group = "net.momirealms" - project.version = "3.4.8" + project.version = "3.4.8.1" apply() apply(plugin = "java") diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 8b902e6..c549771 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -4,7 +4,7 @@ dependencies { compileOnly("com.infernalsuite.aswm:api:1.20.4-R0.1-SNAPSHOT") // Command - compileOnly("dev.jorel:commandapi-bukkit-core:9.3.0") + compileOnly("dev.jorel:commandapi-bukkit-core:9.4.1") // Common hooks compileOnly("me.clip:placeholderapi:2.11.5") @@ -12,7 +12,7 @@ dependencies { compileOnly("com.github.MilkBowl:VaultAPI:1.7") // Utils - compileOnly("dev.dejvokep:boosted-yaml:1.3.2") + compileOnly("dev.dejvokep:boosted-yaml:1.3.4") compileOnly("commons-io:commons-io:2.15.1") compileOnly("com.google.code.gson:gson:2.10.1") compileOnly("net.objecthunter:exp4j:0.4.8") @@ -50,13 +50,13 @@ dependencies { implementation(project(":oraxen-legacy")) implementation(project(":oraxen-j21")) implementation(project(":legacy-api")) - compileOnly("net.kyori:adventure-api:4.16.0") + compileOnly("net.kyori:adventure-api:4.17.0") compileOnly("net.kyori:adventure-platform-bukkit:4.3.2") compileOnly("com.github.Xiao-MoMi:AntiGriefLib:0.11") compileOnly("com.github.Xiao-MoMi:BiomeAPI:0.6") - compileOnly("net.kyori:adventure-text-minimessage:4.16.0") - compileOnly("net.kyori:adventure-text-serializer-legacy:4.16.0") + compileOnly("net.kyori:adventure-text-minimessage:4.17.0") + compileOnly("net.kyori:adventure-text-serializer-legacy:4.17.0") compileOnly("de.tr7zw:item-nbt-api:2.12.4") compileOnly("org.bstats:bstats-bukkit:3.0.2") implementation("com.flowpowered:flow-nbt:2.0.2") diff --git a/plugin/src/main/java/net/momirealms/customcrops/libraries/dependencies/Dependency.java b/plugin/src/main/java/net/momirealms/customcrops/libraries/dependencies/Dependency.java index 0af56be..68cf961 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/libraries/dependencies/Dependency.java +++ b/plugin/src/main/java/net/momirealms/customcrops/libraries/dependencies/Dependency.java @@ -72,7 +72,7 @@ public enum Dependency { BOOSTED_YAML( "dev{}dejvokep", "boosted-yaml", - "1.3.2", + "1.3.4", null, "boosted-yaml", Relocation.of("boostedyaml", "dev{}dejvokep{}boostedyaml")