mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-22 02:35:21 +01:00
Merge branch 'develop' into multi_island_aware_admin_team_commands
This commit is contained in:
commit
aac79636d3
@ -1,7 +1,10 @@
|
|||||||
package world.bentobox.bentobox.listeners.flags.protection;
|
package world.bentobox.bentobox.listeners.flags.protection;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Egg;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
import org.bukkit.event.player.PlayerEggThrowEvent;
|
import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.flags.FlagListener;
|
import world.bentobox.bentobox.api.flags.FlagListener;
|
||||||
@ -24,4 +27,19 @@ public class EggListener extends FlagListener {
|
|||||||
e.setHatching(false);
|
e.setHatching(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle visitor chicken egg hitting
|
||||||
|
* @param e - event
|
||||||
|
*/
|
||||||
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
|
public void onEggHit(ProjectileHitEvent e) {
|
||||||
|
if (e.getEntity() instanceof Egg egg) {
|
||||||
|
if (egg.getShooter() instanceof Player player) {
|
||||||
|
if (!checkIsland(e, player, egg.getLocation(), Flags.EGGS)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user