From d82b3488a2c6eb50011ece47e99f9f69945923ef Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 18 Aug 2024 19:40:08 -0700 Subject: [PATCH] Expand crop harvesting #2472 --- .../flags/protection/BlockInteractionListener.java | 3 ++- .../flags/protection/BreakBlocksListener.java | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java index 496ae5238..e2db22df3 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java @@ -123,7 +123,8 @@ public class BlockInteractionListener extends FlagListener case DRAGON_EGG -> this.checkIsland(e, player, loc, Flags.DRAGON_EGG); case END_PORTAL_FRAME, RESPAWN_ANCHOR -> this.checkIsland(e, player, loc, Flags.PLACE_BLOCKS); case GLOW_ITEM_FRAME, ITEM_FRAME -> this.checkIsland(e, player, loc, Flags.ITEM_FRAME); - case SWEET_BERRY_BUSH, CAVE_VINES -> this.checkIsland(e, player, loc, Flags.BREAK_BLOCKS); + case SWEET_BERRY_BUSH -> this.checkIsland(e, player, loc, Flags.HARVEST); + case CAVE_VINES -> this.checkIsland(e, player, loc, Flags.BREAK_BLOCKS); case CAKE -> this.checkIsland(e, player, loc, Flags.CAKE); case CHISELED_BOOKSHELF -> this.checkIsland(e, player, loc, Flags.BOOKSHELF); case LAVA_CAULDRON -> diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java index bf8ec1cab..df7acc554 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java @@ -5,7 +5,6 @@ import org.bukkit.Material; import org.bukkit.Tag; import org.bukkit.block.data.BlockData; import org.bukkit.block.data.type.CaveVinesPlant; -import org.bukkit.entity.AbstractArrow; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.ItemFrame; @@ -23,6 +22,7 @@ import org.bukkit.event.vehicle.VehicleDamageEvent; import com.google.common.base.Enums; +import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.api.flags.FlagListener; import world.bentobox.bentobox.lists.Flags; @@ -38,15 +38,21 @@ public class BreakBlocksListener extends FlagListener { Player p = e.getPlayer(); Location l = e.getBlock().getLocation(); Material m = e.getBlock().getType(); + BentoBox.getInstance().logDebug(m); if (m.equals(Material.MELON) || m.equals(Material.PUMPKIN)) { this.checkIsland(e, p, l, Flags.HARVEST); } else { // Crops - if (Tag.CROPS.isTagged(m) + if ((Tag.CROPS.isTagged(m) && !m.equals(Material.MELON_STEM) && !m.equals(Material.PUMPKIN_STEM) && !m.equals(Material.ATTACHED_MELON_STEM) - && !m.equals(Material.ATTACHED_PUMPKIN_STEM)) { + && !m.equals(Material.ATTACHED_PUMPKIN_STEM)) + || m == Material.COCOA + || m == Material.SWEET_BERRY_BUSH + || m == Material.BAMBOO + || m == Material.NETHER_WART + ) { this.checkIsland(e, p, l, Flags.HARVEST); } else { checkIsland(e, p, l, Flags.BREAK_BLOCKS);