Skip to content

Commit

Permalink
Merge pull request #2543 from Dreeam-qwq/fix/parrot-interact
Browse files Browse the repository at this point in the history
Fix parrot interaction condition
  • Loading branch information
tastybento authored Nov 6, 2024
2 parents 41a2484 + 12109eb commit e761d65
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ public void onFishing(PlayerFishEvent e) {
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerFeedParrots(PlayerInteractEntityEvent e) {
if (e.getRightClicked() instanceof Parrot
&& (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))) {
if (((Parrot) e.getRightClicked()).isTamed()) {
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_TAMED_ANIMALS);
} else {
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_ANIMALS);
if (e.getRightClicked() instanceof Parrot parrot) {
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))) {
if (parrot.isTamed()) {
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_TAMED_ANIMALS);
} else {
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.HURT_ANIMALS);
}
}
}
}
Expand Down

0 comments on commit e761d65

Please sign in to comment.