diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BucketListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BucketListener.java index 640a6d9dd..026fb13d2 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BucketListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BucketListener.java @@ -2,6 +2,7 @@ package world.bentobox.bentobox.listeners.flags.protection; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.entity.MushroomCow; import org.bukkit.entity.TropicalFish; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -59,4 +60,16 @@ public class BucketListener extends FlagListener { checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.FISH_SCOOPING); } } + + + /** + * Prevents collecting mushroom strew from MushroomCow if player does not have access to Milking flag. + * @param e - event + */ + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + public void onBowlFill(final PlayerInteractEntityEvent e) { + if (e.getRightClicked() instanceof MushroomCow && e.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.BOWL)) { + checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.MILKING); + } + } } \ No newline at end of file