Container permission fixed ( relationally )

This commit is contained in:
ProSavage 2018-10-17 15:53:10 -05:00
parent 18416f4d21
commit 38db648044

View File

@ -301,16 +301,30 @@ public class FactionsPlayerListener implements Listener {
return true; return true;
} }
} }
// Move up access check to check for exceptions
Access access = otherFaction.getAccess(me, action);
boolean doTerritoryEnemyProtectedCheck = true;
// You may use any block unless it is another faction's territory... if (action.equals(PermissableAction.CONTAINER)) {
if (rel.isNeutral() || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials) || (rel.isTruce() && Conf.territoryTruceProtectMaterials)) { if (access == Access.ALLOW) {
if (!justCheck) { doTerritoryEnemyProtectedCheck = false;
me.msg(TL.PLAYER_USE_TERRITORY, (material == P.p.SOIL ? "trample " : "use ") + TextUtil.getMaterialName(material), otherFaction.getTag(myFaction));
} }
return false;
} }
Access access = otherFaction.getAccess(me, action); // Did not nest the boolean so that it stands out when Im looking
// through the code later.
if (doTerritoryEnemyProtectedCheck) {
// You may use any block unless it is another faction's territory...
if (rel.isNeutral() || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials) || (rel.isTruce() && Conf.territoryTruceProtectMaterials)) {
if (!justCheck) {
me.msg(TL.PLAYER_USE_TERRITORY, (material == P.p.SOIL ? "trample " : "use ") + TextUtil.getMaterialName(material), otherFaction.getTag(myFaction));
}
return false;
}
}
if (access != Access.ALLOW && me.getRole() != Role.ADMIN) { if (access != Access.ALLOW && me.getRole() != Role.ADMIN) {
// TODO: Update this once new access values are added other than just allow / deny. // TODO: Update this once new access values are added other than just allow / deny.
if ((myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && myFaction.getOwnerListString(loc).contains(player.getName()))) { if ((myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && myFaction.getOwnerListString(loc).contains(player.getName()))) {