1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-03 21:28:00 +02:00

Fix bug in sign state loop

This commit is contained in:
snowleo
2011-11-04 01:23:50 +01:00
parent 7d936a639c
commit 0e9eddd2f9

View File

@@ -35,11 +35,16 @@ public class SignProtection extends EssentialsSign
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException
{
sign.setLine(3, "§4" + username);
if (hasAdjacentBlock(sign.getBlock()) && isBlockProtected(sign.getBlock(), player, username, true) != SignProtectionState.NOT_ALLOWED)
if (hasAdjacentBlock(sign.getBlock()))
{
final SignProtectionState state = isBlockProtected(sign.getBlock(), player, username, 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"));
return false;
}
@@ -183,11 +188,6 @@ public class SignProtection extends EssentialsSign
SignProtectionState retstate = SignProtectionState.NOSIGN;
for (SignProtectionState state : signs.values())
{
if (state == SignProtectionState.OWNER)
{
return state;
}
if (state == SignProtectionState.ALLOWED)
{
retstate = state;
@@ -197,6 +197,16 @@ public class SignProtection extends EssentialsSign
retstate = state;
}
}
if (!secure || retstate == SignProtectionState.NOSIGN)
{
for (SignProtectionState state : signs.values())
{
if (state == SignProtectionState.OWNER)
{
return state;
}
}
}
return retstate;
}