summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIaccidentally <coryhuckaby@gmail.com>2013-04-01 14:18:16 -0700
committerIaccidentally <coryhuckaby@gmail.com>2013-04-01 14:18:16 -0700
commitcd50ee27326f03a58630f7ca90ee7b7f783fc5bb (patch)
treeea154fec9be2bc1ed269e24fb11d667daee211d8
parentd91b174f9633f370313ed8751fbe2c2a2638ac4f (diff)
parent9288daec8d491097464325914b374a521930dcc7 (diff)
downloadEssentials-cd50ee27326f03a58630f7ca90ee7b7f783fc5bb.tar
Essentials-cd50ee27326f03a58630f7ca90ee7b7f783fc5bb.tar.gz
Essentials-cd50ee27326f03a58630f7ca90ee7b7f783fc5bb.tar.lz
Essentials-cd50ee27326f03a58630f7ca90ee7b7f783fc5bb.tar.xz
Essentials-cd50ee27326f03a58630f7ca90ee7b7f783fc5bb.zip
Merge pull request #432 from GunfighterJ/master
Fix spaces into tabs.
-rw-r--r--Essentials/src/net/ess3/settings/protect/Prevent.java58
-rw-r--r--EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java450
-rw-r--r--EssentialsProtect/src/net/ess3/protect/Permissions.java116
3 files changed, 312 insertions, 312 deletions
diff --git a/Essentials/src/net/ess3/settings/protect/Prevent.java b/Essentials/src/net/ess3/settings/protect/Prevent.java
index f9b14fcaf..c5aaa7f3e 100644
--- a/Essentials/src/net/ess3/settings/protect/Prevent.java
+++ b/Essentials/src/net/ess3/settings/protect/Prevent.java
@@ -11,33 +11,33 @@ import net.ess3.storage.StorageObject;
public class Prevent implements StorageObject
{
- private boolean lavaFlow = false;
- private boolean waterFlow = false;
- // private boolean waterbucketFlow = false; TODO: Test if this still works
- private boolean firespread = true;
- private boolean lavaFirespread = true;
- private boolean lightningFirespread = true;
- private boolean portalCreation = false;
- private boolean tntBlockdamage = false;
- private boolean tntPlayerdamage = false;
- private boolean tntMinecartBlockdamage = false;
- private boolean tntMinecartPlayerdamage = false;
- private boolean fireballBlockdamage = false;
- private boolean fireballPlayerdamage = false;
- private boolean fireballFire = false;
- private boolean creeperBlockdamage = false;
- private boolean creeperPlayerdamage = false;
- private boolean enderdragonBlockdamage = false;
- private boolean witherSpawnBlockdamage = false;
- private boolean witherSpawnPlayerdamage = false;
- private boolean witherskullBlockdamage = false;
- private boolean witherskullPlayerdamage = false;
- private boolean witherBlockreplace = false;
- private boolean endermanPickup = false;
- private boolean villagerDeath = false;
- @Comment(
- {
- "Monsters won't follow players", "permission essentials.protect.entitytarget.bypass disables this"
- })
- private boolean entitytarget = false;
+ private boolean lavaFlow = false;
+ private boolean waterFlow = false;
+ // private boolean waterbucketFlow = false; TODO: Test if this still works
+ private boolean firespread = true;
+ private boolean lavaFirespread = true;
+ private boolean lightningFirespread = true;
+ private boolean portalCreation = false;
+ private boolean tntBlockdamage = false;
+ private boolean tntPlayerdamage = false;
+ private boolean tntMinecartBlockdamage = false;
+ private boolean tntMinecartPlayerdamage = false;
+ private boolean fireballBlockdamage = false;
+ private boolean fireballPlayerdamage = false;
+ private boolean fireballFire = false;
+ private boolean creeperBlockdamage = false;
+ private boolean creeperPlayerdamage = false;
+ private boolean enderdragonBlockdamage = false;
+ private boolean witherSpawnBlockdamage = false;
+ private boolean witherSpawnPlayerdamage = false;
+ private boolean witherskullBlockdamage = false;
+ private boolean witherskullPlayerdamage = false;
+ private boolean witherBlockreplace = false;
+ private boolean endermanPickup = false;
+ private boolean villagerDeath = false;
+ @Comment(
+ {
+ "Monsters won't follow players", "permission essentials.protect.entitytarget.bypass disables this"
+ })
+ private boolean entitytarget = false;
} \ No newline at end of file
diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java
index 68445caec..8fb893809 100644
--- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java
@@ -14,253 +14,253 @@ import org.bukkit.event.hanging.HangingBreakEvent;
public class EssentialsProtectEntityListener implements Listener
{
- private final IProtect prot;
+ private final IProtect prot;
- public EssentialsProtectEntityListener(final IProtect prot)
- {
- super();
- this.prot = prot;
- }
+ public EssentialsProtectEntityListener(final IProtect prot)
+ {
+ super();
+ this.prot = prot;
+ }
- private Prevent getSettings()
- {
- return prot.getSettings().getData().getPrevent();
- }
+ private Prevent getSettings()
+ {
+ return prot.getSettings().getData().getPrevent();
+ }
- @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
- public void onEntityDamage(final EntityDamageEvent event)
- {
- final Entity target = event.getEntity();
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void onEntityDamage(final EntityDamageEvent event)
+ {
+ final Entity target = event.getEntity();
- if (target instanceof Villager && getSettings().isVillagerDeath())
- {
- event.setCancelled(true);
- return;
- }
+ if (target instanceof Villager && getSettings().isVillagerDeath())
+ {
+ event.setCancelled(true);
+ return;
+ }
- final Player user = target instanceof Player ? (Player) target : null;
- if (target instanceof Player && event instanceof EntityDamageByBlockEvent)
- {
- final DamageCause cause = event.getCause();
+ final Player user = target instanceof Player ? (Player) target : null;
+ if (target instanceof Player && event instanceof EntityDamageByBlockEvent)
+ {
+ final DamageCause cause = event.getCause();
- if (cause == DamageCause.CONTACT && (Permissions.PREVENTDAMAGE_CONTACT.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
- if (cause == DamageCause.LAVA && (Permissions.PREVENTDAMAGE_LAVADAMAGE.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
- if (cause == DamageCause.BLOCK_EXPLOSION && (Permissions.PREVENTDAMAGE_TNT.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
- }
+ if (cause == DamageCause.CONTACT && (Permissions.PREVENTDAMAGE_CONTACT.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ if (cause == DamageCause.LAVA && (Permissions.PREVENTDAMAGE_LAVADAMAGE.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ if (cause == DamageCause.BLOCK_EXPLOSION && (Permissions.PREVENTDAMAGE_TNT.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ }
- if (target instanceof Player && event instanceof EntityDamageByEntityEvent)
- {
- final EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent) event;
- final Entity eAttack = edEvent.getDamager();
- final Player attacker = eAttack instanceof Player ? (Player) eAttack : null;
+ if (target instanceof Player && event instanceof EntityDamageByEntityEvent)
+ {
+ final EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent) event;
+ final Entity eAttack = edEvent.getDamager();
+ final Player attacker = eAttack instanceof Player ? (Player) eAttack : null;
- // PVP Settings
- if (target instanceof Player && eAttack instanceof Player && (!Permissions.PVP.isAuthorized(user) || !Permissions.PVP.isAuthorized(attacker)))
- {
- event.setCancelled(true);
- return;
- }
+ // PVP Settings
+ if (target instanceof Player && eAttack instanceof Player && (!Permissions.PVP.isAuthorized(user) || !Permissions.PVP.isAuthorized(attacker)))
+ {
+ event.setCancelled(true);
+ return;
+ }
- //Player damage prevention section
- if (eAttack instanceof Creeper && getSettings().isCreeperPlayerdamage() || (Permissions.PREVENTDAMAGE_CREEPER.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
+ //Player damage prevention section
+ if (eAttack instanceof Creeper && getSettings().isCreeperPlayerdamage() || (Permissions.PREVENTDAMAGE_CREEPER.isAuthorized(
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
- if (eAttack instanceof ExplosiveMinecart && getSettings().isTntMinecartPlayerdamage() || (Permissions.PREVENTDAMAGE_TNTMINECART.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
+ if (eAttack instanceof ExplosiveMinecart && getSettings().isTntMinecartPlayerdamage() || (Permissions.PREVENTDAMAGE_TNTMINECART.isAuthorized(
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
- if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball || event.getEntity() instanceof LargeFireball) && (Permissions.PREVENTDAMAGE_FIREBALL.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
+ if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball || event.getEntity() instanceof LargeFireball) && (Permissions.PREVENTDAMAGE_FIREBALL.isAuthorized(
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
- if ((eAttack instanceof WitherSkull && Permissions.PREVENTDAMAGE_WITHERSKULL.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
+ if ((eAttack instanceof WitherSkull && Permissions.PREVENTDAMAGE_WITHERSKULL.isAuthorized(
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
- if ((eAttack instanceof Wither && event.getCause() == DamageCause.ENTITY_EXPLOSION) && getSettings().isWitherSpawnPlayerdamage() || (Permissions.PREVENTDAMAGE_WITHER.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
+ if ((eAttack instanceof Wither && event.getCause() == DamageCause.ENTITY_EXPLOSION) && getSettings().isWitherSpawnPlayerdamage() || (Permissions.PREVENTDAMAGE_WITHER.isAuthorized(
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
- if (eAttack instanceof TNTPrimed && (Permissions.PREVENTDAMAGE_TNT.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
+ if (eAttack instanceof TNTPrimed && (Permissions.PREVENTDAMAGE_TNT.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
- if (edEvent.getDamager() instanceof Projectile && ((Permissions.PREVENTDAMAGE_PROJECTILES.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(
- user)) || (((Projectile) edEvent.getDamager()).getShooter() instanceof Player && (!Permissions.PVP.isAuthorized(
- user) || !Permissions.PVP.isAuthorized((Player) ((Projectile) edEvent.getDamager()).getShooter())))))
- {
- event.setCancelled(true);
- return;
- }
- }
+ if (edEvent.getDamager() instanceof Projectile && ((Permissions.PREVENTDAMAGE_PROJECTILES.isAuthorized(
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(
+ user)) || (((Projectile) edEvent.getDamager()).getShooter() instanceof Player && (!Permissions.PVP.isAuthorized(
+ user) || !Permissions.PVP.isAuthorized((Player) ((Projectile) edEvent.getDamager()).getShooter())))))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ }
- final DamageCause cause = event.getCause();
- if (target instanceof Player)
- {
- if (cause == DamageCause.FALL && (Permissions.PREVENTDAMAGE_FALL.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
+ final DamageCause cause = event.getCause();
+ if (target instanceof Player)
+ {
+ if (cause == DamageCause.FALL && (Permissions.PREVENTDAMAGE_FALL.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
- if (cause == DamageCause.SUFFOCATION && (Permissions.PREVENTDAMAGE_SUFFOCATION.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(
- user)))
- {
- event.setCancelled(true);
- return;
- }
- if ((cause == DamageCause.FIRE || cause == DamageCause.FIRE_TICK) && (Permissions.PREVENTDAMAGE_FIRE.isAuthorized(
- user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
- if (cause == DamageCause.DROWNING && (Permissions.PREVENTDAMAGE_DROWNING.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
- {
- event.setCancelled(true);
- return;
- }
- if (cause == DamageCause.LIGHTNING && (Permissions.PREVENTDAMAGE_LIGHTNING.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(
- user)))
- {
- event.setCancelled(true);
- }
- if (cause == DamageCause.WITHER && (Permissions.PREVENTDAMAGE_WITHER.isAuthorized(user)) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))
- {
- event.setCancelled(true);
- }
- }
- }
+ if (cause == DamageCause.SUFFOCATION && (Permissions.PREVENTDAMAGE_SUFFOCATION.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(
+ user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ if ((cause == DamageCause.FIRE || cause == DamageCause.FIRE_TICK) && (Permissions.PREVENTDAMAGE_FIRE.isAuthorized(
+ user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ if (cause == DamageCause.DROWNING && (Permissions.PREVENTDAMAGE_DROWNING.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user)))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ if (cause == DamageCause.LIGHTNING && (Permissions.PREVENTDAMAGE_LIGHTNING.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(
+ user)))
+ {
+ event.setCancelled(true);
+ }
+ if (cause == DamageCause.WITHER && (Permissions.PREVENTDAMAGE_WITHER.isAuthorized(user)) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))
+ {
+ event.setCancelled(true);
+ }
+ }
+ }
- @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
- public void onEntityExplode(final EntityExplodeEvent event)
- {
- final int maxHeight = prot.getSettings().getData().getCreeperMaxHeight();
- Entity entity = event.getEntity();
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void onEntityExplode(final EntityExplodeEvent event)
+ {
+ final int maxHeight = prot.getSettings().getData().getCreeperMaxHeight();
+ Entity entity = event.getEntity();
- //Block damage prevention section
- if (entity instanceof EnderDragon && getSettings().isEnderdragonBlockdamage())
- {
- event.setCancelled(true);
- }
- else if (entity instanceof Wither && getSettings().isWitherSpawnBlockdamage())
- {
- event.setCancelled(true);
- }
- else if (entity instanceof Creeper && (getSettings().isCreeperBlockdamage() || getSettings().isCreeperBlockdamage()
- || (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight)))
- {
- event.setCancelled(true);
- event.getLocation().getWorld().createExplosion(event.getLocation(), 0F);
- }
- else if (entity instanceof TNTPrimed && getSettings().isTntBlockdamage())
- {
- event.setCancelled(true);
- }
- else if ((entity instanceof Fireball || entity instanceof SmallFireball) && getSettings().isFireballBlockdamage())
- {
- event.setCancelled(true);
- }
- else if ((entity instanceof WitherSkull) && getSettings().isWitherskullBlockdamage())
- {
- event.setCancelled(true);
- }
- else if ((entity instanceof ExplosiveMinecart) && getSettings().isTntMinecartBlockdamage())
- {
- event.setCancelled(true);
- }
- }
+ //Block damage prevention section
+ if (entity instanceof EnderDragon && getSettings().isEnderdragonBlockdamage())
+ {
+ event.setCancelled(true);
+ }
+ else if (entity instanceof Wither && getSettings().isWitherSpawnBlockdamage())
+ {
+ event.setCancelled(true);
+ }
+ else if (entity instanceof Creeper && (getSettings().isCreeperBlockdamage() || getSettings().isCreeperBlockdamage()
+ || (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight)))
+ {
+ event.setCancelled(true);
+ event.getLocation().getWorld().createExplosion(event.getLocation(), 0F);
+ }
+ else if (entity instanceof TNTPrimed && getSettings().isTntBlockdamage())
+ {
+ event.setCancelled(true);
+ }
+ else if ((entity instanceof Fireball || entity instanceof SmallFireball) && getSettings().isFireballBlockdamage())
+ {
+ event.setCancelled(true);
+ }
+ else if ((entity instanceof WitherSkull) && getSettings().isWitherskullBlockdamage())
+ {
+ event.setCancelled(true);
+ }
+ else if ((entity instanceof ExplosiveMinecart) && getSettings().isTntMinecartBlockdamage())
+ {
+ event.setCancelled(true);
+ }
+ }
- @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
- public void onEntityTarget(final EntityTargetEvent event)
- {
- final Entity entity = event.getTarget();
- if (entity == null)
- {
- return;
- }
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void onEntityTarget(final EntityTargetEvent event)
+ {
+ final Entity entity = event.getTarget();
+ if (entity == null)
+ {
+ return;
+ }
- if (entity.getType() == EntityType.PLAYER)
- {
- final Player user = (Player) event.getTarget();
- if ((event.getReason() == TargetReason.CLOSEST_PLAYER || event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY || event.getReason() == TargetReason.PIG_ZOMBIE_TARGET
- || event.getReason() == TargetReason.RANDOM_TARGET || event.getReason() == TargetReason.TARGET_ATTACKED_OWNER
- || event.getReason() == TargetReason.OWNER_ATTACKED_TARGET)
- && !prot.getSettings().getData().getPrevent().isEntitytarget() && !Permissions.ENTITY_TARGET_BYPASS.isAuthorized(
- user, event.getEntity().getType().getName().toLowerCase()))
- {
- event.setCancelled(true);
- }
- }
- }
+ if (entity.getType() == EntityType.PLAYER)
+ {
+ final Player user = (Player) event.getTarget();
+ if ((event.getReason() == TargetReason.CLOSEST_PLAYER || event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY || event.getReason() == TargetReason.PIG_ZOMBIE_TARGET
+ || event.getReason() == TargetReason.RANDOM_TARGET || event.getReason() == TargetReason.TARGET_ATTACKED_OWNER
+ || event.getReason() == TargetReason.OWNER_ATTACKED_TARGET)
+ && !prot.getSettings().getData().getPrevent().isEntitytarget() && !Permissions.ENTITY_TARGET_BYPASS.isAuthorized(
+ user, event.getEntity().getType().getName().toLowerCase()))
+ {
+ event.setCancelled(true);
+ }
+ }
+ }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onExplosionPrime(final ExplosionPrimeEvent event)
- {
- if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball) && getSettings().isFireballFire())
- {
- event.setFire(false);
- }
- }
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onExplosionPrime(final ExplosionPrimeEvent event)
+ {
+ if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball) && getSettings().isFireballFire())
+ {
+ event.setFire(false);
+ }
+ }
- @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
- public void onEntityChangeBlock(final EntityChangeBlockEvent event)
- {
- if (event.getEntityType() == EntityType.ENDERMAN && getSettings().isEndermanPickup())
- {
- event.setCancelled(true);
- }
- if (event.getEntityType() == EntityType.WITHER && getSettings().isWitherBlockreplace())
- {
- event.setCancelled(true);
- }
- }
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void onEntityChangeBlock(final EntityChangeBlockEvent event)
+ {
+ if (event.getEntityType() == EntityType.ENDERMAN && getSettings().isEndermanPickup())
+ {
+ event.setCancelled(true);
+ }
+ if (event.getEntityType() == EntityType.WITHER && getSettings().isWitherBlockreplace())
+ {
+ event.setCancelled(true);
+ }
+ }
- @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
- public void onPaintingBreak(final HangingBreakByEntityEvent event)
- {
- final ProtectHolder settings = prot.getSettings();
- Entity remover = event.getRemover();
- if ((event.getCause() == HangingBreakEvent.RemoveCause.ENTITY)
- && ((remover instanceof Creeper) && getSettings().isCreeperBlockdamage())
- || ((remover instanceof Wither) && getSettings().isWitherSpawnBlockdamage())
- || ((remover instanceof Fireball) && getSettings().isFireballBlockdamage())
- || ((remover instanceof TNTPrimed) && getSettings().isTntBlockdamage())
- || ((remover instanceof WitherSkull) && getSettings().isWitherskullBlockdamage())
- || ((remover instanceof ExplosiveMinecart) && getSettings().isTntMinecartBlockdamage()))
- {
- event.setCancelled(true);
- }
- }
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void onPaintingBreak(final HangingBreakByEntityEvent event)
+ {
+ final ProtectHolder settings = prot.getSettings();
+ Entity remover = event.getRemover();
+ if ((event.getCause() == HangingBreakEvent.RemoveCause.ENTITY)
+ && ((remover instanceof Creeper) && getSettings().isCreeperBlockdamage())
+ || ((remover instanceof Wither) && getSettings().isWitherSpawnBlockdamage())
+ || ((remover instanceof Fireball) && getSettings().isFireballBlockdamage())
+ || ((remover instanceof TNTPrimed) && getSettings().isTntBlockdamage())
+ || ((remover instanceof WitherSkull) && getSettings().isWitherskullBlockdamage())
+ || ((remover instanceof ExplosiveMinecart) && getSettings().isTntMinecartBlockdamage()))
+ {
+ event.setCancelled(true);
+ }
+ }
}
diff --git a/EssentialsProtect/src/net/ess3/protect/Permissions.java b/EssentialsProtect/src/net/ess3/protect/Permissions.java
index 241be035f..306a09152 100644
--- a/EssentialsProtect/src/net/ess3/protect/Permissions.java
+++ b/EssentialsProtect/src/net/ess3/protect/Permissions.java
@@ -10,69 +10,69 @@ import org.bukkit.permissions.PermissionDefault;
public enum Permissions implements IPermission
{
- PVP(PermissionDefault.TRUE),
- PREVENTDAMAGE_FALL(PermissionDefault.FALSE),
- PREVENTDAMAGE_CREEPER(PermissionDefault.FALSE),
- PREVENTDAMAGE_CONTACT(PermissionDefault.FALSE),
- PREVENTDAMAGE_FIREBALL(PermissionDefault.FALSE),
- PREVENTDAMAGE_PROJECTILES(PermissionDefault.FALSE),
- PREVENTDAMAGE_LAVADAMAGE(PermissionDefault.FALSE),
- PREVENTDAMAGE_TNT(PermissionDefault.FALSE),
- PREVENTDAMAGE_TNTMINECART(PermissionDefault.FALSE),
- PREVENTDAMAGE_SUFFOCATION(PermissionDefault.FALSE),
- PREVENTDAMAGE_FIRE(PermissionDefault.FALSE),
- PREVENTDAMAGE_DROWNING(PermissionDefault.FALSE),
- PREVENTDAMAGE_LIGHTNING(PermissionDefault.FALSE),
- PREVENTDAMAGE_WITHER(PermissionDefault.FALSE),
- PREVENTDAMAGE_WITHERSKULL(PermissionDefault.FALSE),
- PREVENTDAMAGE_NONE(PermissionDefault.FALSE),
- USEFLINTSTEEL(PermissionDefault.TRUE);
- private static final String base = "essentials.protect.";
- private final String permission;
- private final PermissionDefault defaultPerm;
- private String parent = null;
+ PVP(PermissionDefault.TRUE),
+ PREVENTDAMAGE_FALL(PermissionDefault.FALSE),
+ PREVENTDAMAGE_CREEPER(PermissionDefault.FALSE),
+ PREVENTDAMAGE_CONTACT(PermissionDefault.FALSE),
+ PREVENTDAMAGE_FIREBALL(PermissionDefault.FALSE),
+ PREVENTDAMAGE_PROJECTILES(PermissionDefault.FALSE),
+ PREVENTDAMAGE_LAVADAMAGE(PermissionDefault.FALSE),
+ PREVENTDAMAGE_TNT(PermissionDefault.FALSE),
+ PREVENTDAMAGE_TNTMINECART(PermissionDefault.FALSE),
+ PREVENTDAMAGE_SUFFOCATION(PermissionDefault.FALSE),
+ PREVENTDAMAGE_FIRE(PermissionDefault.FALSE),
+ PREVENTDAMAGE_DROWNING(PermissionDefault.FALSE),
+ PREVENTDAMAGE_LIGHTNING(PermissionDefault.FALSE),
+ PREVENTDAMAGE_WITHER(PermissionDefault.FALSE),
+ PREVENTDAMAGE_WITHERSKULL(PermissionDefault.FALSE),
+ PREVENTDAMAGE_NONE(PermissionDefault.FALSE),
+ USEFLINTSTEEL(PermissionDefault.TRUE);
+ private static final String base = "essentials.protect.";
+ private final String permission;
+ private final PermissionDefault defaultPerm;
+ private String parent = null;
- private Permissions()
- {
- this(PermissionDefault.OP);
- }
+ private Permissions()
+ {
+ this(PermissionDefault.OP);
+ }
- private Permissions(final PermissionDefault defaultPerm)
- {
- permission = base + toString().toLowerCase(Locale.ENGLISH).replace('_', '.');
- this.defaultPerm = defaultPerm;
- }
+ private Permissions(final PermissionDefault defaultPerm)
+ {
+ permission = base + toString().toLowerCase(Locale.ENGLISH).replace('_', '.');
+ this.defaultPerm = defaultPerm;
+ }
- @Override
- public String getPermissionName()
- {
- return permission;
- }
+ @Override
+ public String getPermissionName()
+ {
+ return permission;
+ }
- @Override
- public String getParentPermission()
- {
- if (parent != null)
- {
- return parent;
- }
- else
- {
- return PermissionFactory.registerParentPermission(getPermissionName());
- }
- }
+ @Override
+ public String getParentPermission()
+ {
+ if (parent != null)
+ {
+ return parent;
+ }
+ else
+ {
+ return PermissionFactory.registerParentPermission(getPermissionName());
+ }
+ }
- @Override
- public PermissionDefault getPermissionDefault()
- {
- return this.defaultPerm;
- }
+ @Override
+ public PermissionDefault getPermissionDefault()
+ {
+ return this.defaultPerm;
+ }
- @Override
- public boolean isAuthorized(final CommandSender sender)
- {
- return PermissionFactory.checkPermission(sender, this);
- }
+ @Override
+ public boolean isAuthorized(final CommandSender sender)
+ {
+ return PermissionFactory.checkPermission(sender, this);
+ }
- public static DotStarPermission ENTITY_TARGET_BYPASS = new DotStarPermission("essentials.protect.entitytarget.bypass");
+ public static DotStarPermission ENTITY_TARGET_BYPASS = new DotStarPermission("essentials.protect.entitytarget.bypass");
}