summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect
diff options
context:
space:
mode:
authorsnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-02 02:43:58 +0000
committersnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-02 02:43:58 +0000
commit3496a8522849034d53e52f1412d7f0459b2c01cb (patch)
treec3cd0e48fe9ca91844eaa6175c49ff98c47ba183 /EssentialsProtect
parent348cb29469b8fbb133044ae7d20bf73d5df43b2b (diff)
downloadEssentials-3496a8522849034d53e52f1412d7f0459b2c01cb.tar
Essentials-3496a8522849034d53e52f1412d7f0459b2c01cb.tar.gz
Essentials-3496a8522849034d53e52f1412d7f0459b2c01cb.tar.lz
Essentials-3496a8522849034d53e52f1412d7f0459b2c01cb.tar.xz
Essentials-3496a8522849034d53e52f1412d7f0459b2c01cb.zip
[trunk] Prevent explosions near protected objects
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1091 e251c2fe-e539-e718-e476-b85c1f46cddb
Diffstat (limited to 'EssentialsProtect')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index cad4389d6..29118bdfb 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -1,6 +1,7 @@
package com.earth2me.essentials.protect;
import com.earth2me.essentials.Essentials;
+import com.earth2me.essentials.EssentialsBlockListener;
import com.earth2me.essentials.User;
import java.util.ArrayList;
import java.util.HashSet;
@@ -8,7 +9,9 @@ import java.util.List;
import net.minecraft.server.ChunkPosition;
import net.minecraft.server.Packet60Explosion;
import org.bukkit.Location;
+import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Creeper;
@@ -187,6 +190,33 @@ public class EssentialsProtectEntityListener extends EntityListener
return;
}
}
+ // This code will prevent explosions near protected rails, signs or protected chests
+ // TODO: Use protect db instead of this code
+ for (Block block : event.blockList())
+ {
+ if ((block.getType() == Material.RAILS || block.getFace(BlockFace.UP).getType() == Material.RAILS) && EssentialsProtect.genSettings.get("protect.protect.rails"))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ if (( block.getType() == Material.WALL_SIGN ||
+ block.getFace(BlockFace.NORTH).getType() == Material.WALL_SIGN ||
+ block.getFace(BlockFace.EAST).getType() == Material.WALL_SIGN ||
+ block.getFace(BlockFace.SOUTH).getType() == Material.WALL_SIGN ||
+ block.getFace(BlockFace.WEST).getType() == Material.WALL_SIGN ||
+ block.getType() == Material.SIGN_POST ||
+ block.getFace(BlockFace.UP).getType() == Material.SIGN_POST) &&
+ EssentialsProtect.genSettings.get("protect.protect.signs"))
+ {
+ event.setCancelled(true);
+ return;
+ }
+ if ( EssentialsBlockListener.protectedBlocks.contains(block.getType()) &&
+ EssentialsBlockListener.isBlockProtected(block)) {
+ event.setCancelled(true);
+ return;
+ }
+ }
}
@Override