Fixed DYE protection being always called when interacting with sheeps

This commit is contained in:
Florian CUNY 2020-02-11 11:14:55 +01:00
parent 9f65537ab8
commit a240a6598d

View File

@ -35,7 +35,10 @@ public class DyeListener extends FlagListener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerInteract(final PlayerInteractEntityEvent e) {
if (e.getRightClicked().getType().equals(EntityType.SHEEP)) {
// We cannot use SheepDyeWoolEvent since it doesn't provide who dyed the sheep
if (e.getRightClicked().getType().equals(EntityType.SHEEP)
&& (e.getPlayer().getInventory().getItemInMainHand().getType().name().contains("DYE")
|| e.getPlayer().getInventory().getItemInOffHand().getType().name().contains("DYE"))) {
checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.DYE);
}
}