mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-05-17 21:09:24 +00:00
[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:
parent
1504979bbb
commit
4363d975b5
1 changed files with 5 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue