Merge branch 'master' of github.com:essentials/Essentials into essmaster

This commit is contained in:
KHobbits 2011-11-04 00:45:03 +00:00
commit 02cc1b9fe9

View File

@ -35,10 +35,15 @@ public class SignProtection extends EssentialsSign
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException
{ {
sign.setLine(3, "§4" + username); sign.setLine(3, "§4" + username);
if (hasAdjacentBlock(sign.getBlock()) && isBlockProtected(sign.getBlock(), player, username, true) != SignProtectionState.NOT_ALLOWED) if (hasAdjacentBlock(sign.getBlock()))
{ {
sign.setLine(3, "§1" + username); final SignProtectionState state = isBlockProtected(sign.getBlock(), player, username, true);
return true; if (state == SignProtectionState.NOSIGN || state == SignProtectionState.OWNER
|| player.isAuthorized("essentials.signs.protection.override"))
{
sign.setLine(3, "§1" + username);
return true;
}
} }
player.sendMessage(Util.i18n("signProtectInvalidLocation")); player.sendMessage(Util.i18n("signProtectInvalidLocation"));
return false; return false;
@ -183,11 +188,6 @@ public class SignProtection extends EssentialsSign
SignProtectionState retstate = SignProtectionState.NOSIGN; SignProtectionState retstate = SignProtectionState.NOSIGN;
for (SignProtectionState state : signs.values()) for (SignProtectionState state : signs.values())
{ {
if (state == SignProtectionState.OWNER)
{
return state;
}
if (state == SignProtectionState.ALLOWED) if (state == SignProtectionState.ALLOWED)
{ {
retstate = state; retstate = state;
@ -197,6 +197,16 @@ public class SignProtection extends EssentialsSign
retstate = state; retstate = state;
} }
} }
if (!secure || retstate == SignProtectionState.NOSIGN)
{
for (SignProtectionState state : signs.values())
{
if (state == SignProtectionState.OWNER)
{
return state;
}
}
}
return retstate; return retstate;
} }
@ -300,7 +310,7 @@ public class SignProtection extends EssentialsSign
player.sendMessage(Util.format("noDestroyPermission", block.getType().toString().toLowerCase())); player.sendMessage(Util.format("noDestroyPermission", block.getType().toString().toLowerCase()));
return false; return false;
} }
@Override @Override
public boolean onBlockBreak(final Block block, final IEssentials ess) public boolean onBlockBreak(final Block block, final IEssentials ess)
{ {
@ -324,7 +334,7 @@ public class SignProtection extends EssentialsSign
return state == SignProtectionState.NOSIGN; return state == SignProtectionState.NOSIGN;
} }
@Override @Override
public boolean onBlockIgnite(final Block block, final IEssentials ess) public boolean onBlockIgnite(final Block block, final IEssentials ess)
{ {