mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-27 18:41:25 +01:00
Adds ender crystal protection.
https://github.com/BentoBoxWorld/BentoBox/issues/589
This commit is contained in:
parent
15f97927de
commit
ff6b754333
@ -3,6 +3,7 @@ package world.bentobox.bentobox.listeners.flags.protection;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.EnderCrystal;
|
||||||
import org.bukkit.entity.ItemFrame;
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
@ -99,11 +100,12 @@ public class BreakBlocksListener extends FlagListener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onEntityDamage(EntityDamageByEntityEvent e) {
|
public void onEntityDamage(EntityDamageByEntityEvent e) {
|
||||||
// Only handle item frames and armor stands
|
// Only handle item frames, armor stands and end crystals
|
||||||
if (!(e.getEntity() instanceof ItemFrame) && !(e.getEntity() instanceof ArmorStand)) {
|
if (!(e.getEntity() instanceof ItemFrame)
|
||||||
|
&& !(e.getEntity() instanceof ArmorStand)
|
||||||
|
&& !(e.getEntity() instanceof EnderCrystal)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the attacker
|
// Get the attacker
|
||||||
if (e.getDamager() instanceof Player) {
|
if (e.getDamager() instanceof Player) {
|
||||||
checkIsland(e, (Player)e.getDamager(), e.getEntity().getLocation(), Flags.BREAK_BLOCKS);
|
checkIsland(e, (Player)e.getDamager(), e.getEntity().getLocation(), Flags.BREAK_BLOCKS);
|
||||||
|
Loading…
Reference in New Issue
Block a user