mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 04:23:02 +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);
|
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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue