mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 03:35:11 +01:00
Fixed MILKING flag not protecting milking Mooshrooms (#602)
Add extra PlayerInteractEntityEvent handling that prevents from using bowl on mooshrooms without MILKING protection flag.
This commit is contained in:
parent
07b4e2d30c
commit
d11a27dc6d
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user