[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
This commit is contained in:
snowleo 2011-04-16 15:53:36 +00:00
parent 1504979bbb
commit 4363d975b5

View file

@ -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); event.setCancelled(true);
user.sendMessage("§cYou do not have permission to destroy that sign."); 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 NOT_ALLOWED = 0;
private static final int ALLOWED = 1; private static final int ALLOWED = 1;
private static final int NOSIGN = 2; private static final int NOSIGN = 2;
private static final int OWNER = 3;
private int checkProtectionSign(Block block, User user) private int checkProtectionSign(Block block, User user)
{ {
@ -251,7 +252,7 @@ public class EssentialsBlockListener extends BlockListener
} }
if (sign.getLine(3).equalsIgnoreCase(user.getName())) if (sign.getLine(3).equalsIgnoreCase(user.getName()))
{ {
return ALLOWED; return OWNER;
} }
return NOT_ALLOWED; return NOT_ALLOWED;
} }
@ -283,7 +284,7 @@ public class EssentialsBlockListener extends BlockListener
{ {
protect = true; protect = true;
} }
if (check == ALLOWED) if (check == ALLOWED || check == OWNER)
{ {
return false; return false;
} }
@ -299,7 +300,7 @@ public class EssentialsBlockListener extends BlockListener
{ {
protect = true; protect = true;
} }
if (check == ALLOWED) if (check == ALLOWED || check == OWNER)
{ {
return false; return false;
} }