diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-16 15:53:36 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-16 15:53:36 +0000 |
commit | 4363d975b526ad1e14f26287140d08bac3c99e2b (patch) | |
tree | 29c66128edb1b25c6a635e3de3b6d758358dfe4c | |
parent | 1504979bbbc1901b20b6434a1d9671fac34b2046 (diff) | |
download | Essentials-4363d975b526ad1e14f26287140d08bac3c99e2b.tar Essentials-4363d975b526ad1e14f26287140d08bac3c99e2b.tar.gz Essentials-4363d975b526ad1e14f26287140d08bac3c99e2b.tar.lz Essentials-4363d975b526ad1e14f26287140d08bac3c99e2b.tar.xz Essentials-4363d975b526ad1e14f26287140d08bac3c99e2b.zip |
[trunk] Protection signs: Only owner of signs can destroy the signs.
This is also guarded by EssentialsProtect.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1229 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r-- | Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java index 8cfd6b9c4..104f6fabf 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java @@ -44,7 +44,7 @@ public class EssentialsBlockListener extends BlockListener } } - if (checkProtectionSign(event.getBlock(), user) == NOT_ALLOWED) + if (checkProtectionSign(event.getBlock(), user) != OWNER) { event.setCancelled(true); user.sendMessage("§cYou do not have permission to destroy that sign."); @@ -230,6 +230,7 @@ public class EssentialsBlockListener extends BlockListener private static final int NOT_ALLOWED = 0; private static final int ALLOWED = 1; private static final int NOSIGN = 2; + private static final int OWNER = 3; private int checkProtectionSign(Block block, User user) { @@ -251,7 +252,7 @@ public class EssentialsBlockListener extends BlockListener } if (sign.getLine(3).equalsIgnoreCase(user.getName())) { - return ALLOWED; + return OWNER; } return NOT_ALLOWED; } @@ -283,7 +284,7 @@ public class EssentialsBlockListener extends BlockListener { protect = true; } - if (check == ALLOWED) + if (check == ALLOWED || check == OWNER) { return false; } @@ -299,7 +300,7 @@ public class EssentialsBlockListener extends BlockListener { protect = true; } - if (check == ALLOWED) + if (check == ALLOWED || check == OWNER) { return false; } |