summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsProtect')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java35
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java4
2 files changed, 32 insertions, 7 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
index 742cb9d6d..da790e0d5 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
@@ -4,6 +4,7 @@ import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFromToEvent;
@@ -47,7 +48,7 @@ public class EssentialsProtectBlockListener extends BlockListener
return;
}
- Block blockPlaced = event.getBlockAgainst();
+ Block blockPlaced = event.getBlockPlaced();
int id = event.getBlockPlaced().getTypeId();
if (EssentialsProtect.checkProtectionItems(EssentialsProtect.blackListPlace, id) && !user.isAuthorized("essentials.protect.exemptplacement"))
@@ -61,7 +62,7 @@ public class EssentialsProtectBlockListener extends BlockListener
parent.alert(user, item.getType().toString(), "placed: ");
}
- if (spData.isBlockAboveProtectedRail(blockPlaced))
+ if (spData.isBlockAboveProtectedRail(blockPlaced.getFace(BlockFace.DOWN)))
{
if (EssentialsProtect.genSettings.get("protect.protect.prevent.block-on-rail"))
{
@@ -70,7 +71,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
- if (item.getTypeId() == 66)
+ if (blockPlaced.getType() == Material.RAILS)
{
if (EssentialsProtect.genSettings.get("protect.protect.rails"))
{
@@ -80,10 +81,34 @@ public class EssentialsProtectBlockListener extends BlockListener
railBlockY = blockPlaced.getY();
railBlockZ = blockPlaced.getZ();
- spData.insertProtectionIntoDb(user.getWorld().getName(), user.getName(), railBlockX, railBlockY + 1, railBlockZ);
+ spData.insertProtectionIntoDb(user.getWorld().getName(), user.getName(), railBlockX, railBlockY, railBlockZ);
if (EssentialsProtect.genSettings.get("protect.protect.block-below"))
{
- spData.insertProtectionIntoDb(user.getWorld().getName(), user.getName(), railBlockX, railBlockY, railBlockZ);
+ spData.insertProtectionIntoDb(user.getWorld().getName(), user.getName(), railBlockX, railBlockY - 1, railBlockZ);
+ }
+ }
+ }
+ }
+ if (blockPlaced.getType() == Material.SIGN_POST || blockPlaced.getType() == Material.WALL_SIGN) {
+ if (EssentialsProtect.genSettings.get("protect.protect.signs"))
+ {
+ if (user.isAuthorized("essentials.protect"))
+ {
+ int signBlockX = blockPlaced.getX();
+ int signBlockY = blockPlaced.getY();
+ int signBlockZ = blockPlaced.getZ();
+
+ initialize();
+ spData.insertProtectionIntoDb(user.getWorld().getName(), user.getName(), signBlockX,
+ signBlockY, signBlockZ);
+
+ if (EssentialsProtect.genSettings.get("protect.protect.block-below"))
+ {
+ signBlockX = event.getBlockAgainst().getX();
+ signBlockY = event.getBlockAgainst().getY();
+ signBlockZ = event.getBlockAgainst().getZ();
+ spData.insertProtectionIntoDb(user.getWorld().getName(), user.getName(), signBlockX,
+ signBlockY, signBlockZ);
}
}
}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
index 6594db1c2..330cb7da8 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
@@ -66,7 +66,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
parent.alert(user, item.getType().toString(), "used: ");
}
- if (item != null && item.getTypeId() == 323)
+ /*if (item != null && item.getTypeId() == 323)
{
if (EssentialsProtect.genSettings.get("protect.protect.signs"))
{
@@ -88,7 +88,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
}
}
}
- }
+ }*/
}
}