mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-25 04:05:36 +01:00
Merge pull request #2543 from Dreeam-qwq/fix/parrot-interact
Fix parrot interaction condition
This commit is contained in:
commit
e761d65c35
@ -114,16 +114,17 @@ public class HurtingListener extends FlagListener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerFeedParrots(PlayerInteractEntityEvent e) {
|
public void onPlayerFeedParrots(PlayerInteractEntityEvent e) {
|
||||||
if (e.getRightClicked() instanceof Parrot
|
if (e.getRightClicked() instanceof Parrot parrot) {
|
||||||
&& (e.getHand().equals(EquipmentSlot.HAND) && e.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.COOKIE))
|
if ((e.getHand().equals(EquipmentSlot.HAND) && e.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.COOKIE))
|
||||||
|| (e.getHand().equals(EquipmentSlot.OFF_HAND) && e.getPlayer().getInventory().getItemInOffHand().getType().equals(Material.COOKIE))) {
|
|| (e.getHand().equals(EquipmentSlot.OFF_HAND) && e.getPlayer().getInventory().getItemInOffHand().getType().equals(Material.COOKIE))) {
|
||||||
if (((Parrot) e.getRightClicked()).isTamed()) {
|
if (parrot.isTamed()) {
|
||||||
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_TAMED_ANIMALS);
|
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_TAMED_ANIMALS);
|
||||||
} else {
|
} else {
|
||||||
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_ANIMALS);
|
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_ANIMALS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks for splash damage. Remove damage if it should not affect.
|
* Checks for splash damage. Remove damage if it should not affect.
|
||||||
|
Loading…
Reference in New Issue
Block a user