Expand crop harvesting #2472

This commit is contained in:
tastybento 2024-08-18 19:40:08 -07:00
parent 103a611b8e
commit d82b3488a2
2 changed files with 11 additions and 4 deletions

View File

@ -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 ->

View File

@ -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);