summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-08-26 05:14:03 +0100
committerKHobbits <rob@khobbits.co.uk>2011-08-26 05:14:03 +0100
commitdfd283d99840f83babe4e2225cd8f41048cb232f (patch)
treed2374d9fc2e9dbb2c858193e41748bb46e021d87
parent016dd10060ca19bcf5bfd8d857b12bc34847cbfc (diff)
parent82819083062975f7515d53ef45312a98a356a07f (diff)
downloadEssentials-dfd283d99840f83babe4e2225cd8f41048cb232f.tar
Essentials-dfd283d99840f83babe4e2225cd8f41048cb232f.tar.gz
Essentials-dfd283d99840f83babe4e2225cd8f41048cb232f.tar.lz
Essentials-dfd283d99840f83babe4e2225cd8f41048cb232f.tar.xz
Essentials-dfd283d99840f83babe4e2225cd8f41048cb232f.zip
Merge branch 'master' of github.com:essentials/Essentials into essmaster
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java17
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignProtection.java8
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java46
4 files changed, 51 insertions, 27 deletions
diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
index a58a1e70d..1bd1d6184 100644
--- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
+++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
@@ -192,8 +192,13 @@ public class EssentialsSign
{
return true;
}
+
+ public boolean onBlockIgnite(final Block block, final IEssentials ess)
+ {
+ return true;
+ }
- public boolean onBlockPush(Block block, IEssentials ess)
+ public boolean onBlockPush(final Block block, final IEssentials ess)
{
return true;
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
index 6f07b67b2..eb6163d20 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
@@ -184,9 +184,24 @@ public class SignBlockListener extends BlockListener
return;
}
- if (protectSignsAndBlocks(event.getBlock(), event.getPlayer()))
+ final Block block = event.getBlock();
+ if (((block.getType() == Material.WALL_SIGN
+ || block.getType() == Material.SIGN_POST)
+ && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
+ || EssentialsSign.checkIfBlockBreaksSigns(block))
{
event.setCancelled(true);
+ return;
+ }
+ for (Signs signs : Signs.values())
+ {
+ final EssentialsSign sign = signs.getSign();
+ if (sign.getBlocks().contains(block.getType())
+ && !sign.onBlockIgnite(block, ess))
+ {
+ event.setCancelled(true);
+ return;
+ }
}
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
index c595d9b03..f9957e646 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
@@ -313,6 +313,14 @@ public class SignProtection extends EssentialsSign
return state == SignProtectionState.NOSIGN;
}
+
+ @Override
+ public boolean onBlockIgnite(final Block block, final IEssentials ess)
+ {
+ final SignProtectionState state = isBlockProtected(block, null, null, false);
+
+ return state == SignProtectionState.NOSIGN;
+ }
@Override
public boolean onBlockPush(final Block block, final IEssentials ess)
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index d85d2b3d7..d96da20a7 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -1,6 +1,5 @@
package com.earth2me.essentials.protect;
-import com.earth2me.essentials.EssentialsBlockListener;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import java.util.HashSet;
@@ -21,11 +20,11 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
+import org.bukkit.entity.Projectile;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityExplodeEvent;
@@ -47,7 +46,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
@Override
- public void onEntityDamage(EntityDamageEvent event)
+ public void onEntityDamage(final EntityDamageEvent event)
{
if (event.isCancelled())
{
@@ -102,7 +101,7 @@ public class EssentialsProtectEntityListener extends EntityListener
event.setCancelled(true);
return;
}
-
+
//Creeper explode prevention
if (eAttack instanceof Creeper && prot.getSettingBool(ProtectConfig.prevent_creeper_explosion)
&& !(target instanceof Player
@@ -121,7 +120,7 @@ public class EssentialsProtectEntityListener extends EntityListener
event.setCancelled(true);
return;
}
-
+
if (eAttack instanceof Fireball && prot.getSettingBool(ProtectConfig.prevent_fireball_playerdmg)
&& !(target instanceof Player
&& user.isAuthorized("essentials.protect.damage.fireball")
@@ -130,7 +129,7 @@ public class EssentialsProtectEntityListener extends EntityListener
event.setCancelled(true);
return;
}
-
+
if (eAttack instanceof TNTPrimed && prot.getSettingBool(ProtectConfig.prevent_tnt_playerdmg)
&& !(target instanceof Player
&& user.isAuthorized("essentials.protect.damage.tnt")
@@ -139,17 +138,20 @@ public class EssentialsProtectEntityListener extends EntityListener
event.setCancelled(true);
return;
}
- }
- if (event instanceof EntityDamageByProjectileEvent
- && target instanceof Player
- && prot.getSettingBool(ProtectConfig.disable_projectiles)
- && !(user.isAuthorized("essentials.protect.damage.projectiles")
- && !user.isAuthorized("essentials.protect.damage.disable")))
- {
- event.setCancelled(true);
- ((EntityDamageByProjectileEvent)event).setBounce(true);
- return;
+ if (edEvent.getDamager() instanceof Projectile
+ && target instanceof Player
+ && ((prot.getSettingBool(ProtectConfig.disable_projectiles)
+ && !(user.isAuthorized("essentials.protect.damage.projectiles")
+ && !user.isAuthorized("essentials.protect.damage.disable")))
+ || (((Projectile)edEvent.getDamager()).getShooter() instanceof Player
+ && prot.getSettingBool(ProtectConfig.disable_pvp)
+ && (!user.isAuthorized("essentials.protect.pvp")
+ || !ess.getUser(((Projectile)edEvent.getDamager()).getShooter()).isAuthorized("essentials.protect.pvp")))))
+ {
+ event.setCancelled(true);
+ return;
+ }
}
final DamageCause cause = event.getCause();
@@ -201,7 +203,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
@Override
- public void onEntityExplode(EntityExplodeEvent event)
+ public void onEntityExplode(final EntityExplodeEvent event)
{
if (event.isCancelled())
{
@@ -240,7 +242,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
((CraftServer)ess.getServer()).getHandle().sendPacketNearby(loc.getX(), loc.getY(), loc.getZ(), 64.0D, ((CraftWorld)loc.getWorld()).getHandle().worldProvider.dimension,
- new Packet60Explosion(loc.getX(), loc.getY(), loc.getZ(), 3.0f, set));
+ new Packet60Explosion(loc.getX(), loc.getY(), loc.getZ(), 3.0f, set));
event.setCancelled(true);
return;
}
@@ -279,12 +281,6 @@ public class EssentialsProtectEntityListener extends EntityListener
event.setCancelled(true);
return;
}
- /*if (EssentialsBlockListener.protectedBlocks.contains(block.getType())
- && EssentialsBlockListener.isBlockProtected(block))
- {
- event.setCancelled(true);
- return;
- }*/
}
}
@@ -340,7 +336,7 @@ public class EssentialsProtectEntityListener extends EntityListener
public void onExplosionPrime(ExplosionPrimeEvent event)
{
if (event.getEntity() instanceof CraftFireball
- && prot.getSettingBool(ProtectConfig.prevent_fireball_fire))
+ && prot.getSettingBool(ProtectConfig.prevent_fireball_fire))
{
event.setFire(false);
}