From 8e169ea2696d2691dca6dff95652904bb6d7b24b Mon Sep 17 00:00:00 2001 From: Magnus Ulf Date: Tue, 14 Jan 2020 23:49:38 +0100 Subject: [PATCH] Fix both #32 and #40 --- src/com/massivecraft/factions/TerritoryAccess.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/com/massivecraft/factions/TerritoryAccess.java b/src/com/massivecraft/factions/TerritoryAccess.java index bc353ae8..7a9ec9da 100644 --- a/src/com/massivecraft/factions/TerritoryAccess.java +++ b/src/com/massivecraft/factions/TerritoryAccess.java @@ -42,7 +42,7 @@ public class TerritoryAccess // The simple ones public TerritoryAccess withHostFactionId(String hostFactionId) { return valueOf(hostFactionId, hostFactionAllowed, grantedIds); } public TerritoryAccess withHostFactionAllowed(Boolean hostFactionAllowed) { return valueOf(hostFactionId, hostFactionAllowed, grantedIds); } - public TerritoryAccess withGrantedIds(Collection factionIds) { return valueOf(hostFactionId, hostFactionAllowed, grantedIds); } + public TerritoryAccess withGrantedIds(Collection grantedIds) { return valueOf(hostFactionId, hostFactionAllowed, grantedIds); } // The intermediate ones public TerritoryAccess withGranted(MPermable mpermable, boolean with) @@ -142,7 +142,7 @@ public class TerritoryAccess public boolean isGranted(String permableId) { - //if (permableId.equals(this.hostFactionId)) return this.isHostFactionAllowed(); + if (permableId.equals(this.hostFactionId)) return this.isHostFactionAllowed(); return this.getGrantedIds().contains(permableId); } @@ -160,12 +160,16 @@ public class TerritoryAccess public AccessStatus getTerritoryAccess(MPlayer mplayer) { if (isGranted(mplayer.getId())) return AccessStatus.ELEVATED; - if (isGranted(mplayer.getFaction().getId())) return AccessStatus.ELEVATED; if (isGranted(mplayer.getRank().getId())) return AccessStatus.ELEVATED; + + if (this.getHostFactionId().equals(mplayer.getFaction().getId())) + { + if (this.isHostFactionAllowed()) return AccessStatus.STANDARD; + else return AccessStatus.DECREASED; + } + if (isGranted(mplayer.getFaction().getId())) return AccessStatus.ELEVATED; if (isGranted(RelationUtil.getRelationOfThatToMe(mplayer, this.getHostFaction()).toString())) return AccessStatus.ELEVATED; - if (this.getHostFactionId().equals(mplayer.getFaction().getId()) && !this.isHostFactionAllowed()) return AccessStatus.DECREASED; - return AccessStatus.STANDARD; }