Containers can now be accessed by default if undefined & the player is in the same faction as the container being accessed.
This commit is contained in:
parent
b0d41c032a
commit
07d8d95969
@ -5,6 +5,8 @@ import com.massivecraft.factions.FLocation;
|
|||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.util.SpiralTask;
|
import com.massivecraft.factions.util.SpiralTask;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
|
|
||||||
@ -34,6 +36,15 @@ public class CmdClaim extends FCommand {
|
|||||||
int radius = this.argAsInt(0, 1); // Default to 1
|
int radius = this.argAsInt(0, 1); // Default to 1
|
||||||
final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own
|
final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own
|
||||||
|
|
||||||
|
if (!fme.isAdminBypassing()) {
|
||||||
|
Access access = forFaction.getAccess(fme, PermissableAction.TERRITORY);
|
||||||
|
if (access == Access.DENY) {
|
||||||
|
fme.msg(TL.GENERIC_NOPERMISSION, "change faction territory!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (radius < 1) {
|
if (radius < 1) {
|
||||||
msg(TL.COMMAND_CLAIM_INVALIDRADIUS);
|
msg(TL.COMMAND_CLAIM_INVALIDRADIUS);
|
||||||
return;
|
return;
|
||||||
|
@ -6,6 +6,8 @@ import com.massivecraft.factions.integration.Econ;
|
|||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.util.SpiralTask;
|
import com.massivecraft.factions.util.SpiralTask;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
@ -33,6 +35,16 @@ public class CmdUnclaim extends FCommand {
|
|||||||
int radius = this.argAsInt(0, 1); // Default to 1
|
int radius = this.argAsInt(0, 1); // Default to 1
|
||||||
final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own
|
final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own
|
||||||
|
|
||||||
|
if (!fme.isAdminBypassing()) {
|
||||||
|
Access access = forFaction.getAccess(fme, PermissableAction.TERRITORY);
|
||||||
|
if (access == Access.DENY) {
|
||||||
|
fme.msg(TL.GENERIC_NOPERMISSION, "change faction territory!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (radius < 1) {
|
if (radius < 1) {
|
||||||
msg(TL.COMMAND_CLAIM_INVALIDRADIUS);
|
msg(TL.COMMAND_CLAIM_INVALIDRADIUS);
|
||||||
return;
|
return;
|
||||||
@ -117,11 +129,16 @@ public class CmdUnclaim extends FCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (targetFaction.getAccess(fme,PermissableAction.TERRITORY) == Access.DENY) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!assertHasFaction()) {
|
if (!assertHasFaction()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!assertMinRole(Role.MODERATOR)) {
|
if (targetFaction.getAccess(fme,PermissableAction.TERRITORY) != Access.ALLOW || !assertMinRole(Role.MODERATOR)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,9 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
|
|
||||||
// F PERM check runs through before other checks.
|
// F PERM check runs through before other checks.
|
||||||
Access access = otherFaction.getAccess(me, action);
|
Access access = otherFaction.getAccess(me, action);
|
||||||
if (access == null || access == Access.DENY) {
|
if (action == PermissableAction.CONTAINER && (access == Access.UNDEFINED || access == Access.ALLOW) && me.getFaction() == otherFaction) {
|
||||||
|
return true;
|
||||||
|
} else if (access == null || access == Access.DENY) {
|
||||||
me.msg(TL.GENERIC_NOPERMISSION, action);
|
me.msg(TL.GENERIC_NOPERMISSION, action);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -734,6 +734,8 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
return true;
|
return true;
|
||||||
} else if (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())) {
|
} else if (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if (forFaction.getAccess(this,PermissableAction.TERRITORY) == Access.ALLOW) {
|
||||||
|
return true;
|
||||||
} else if (myFaction != forFaction) {
|
} else if (myFaction != forFaction) {
|
||||||
error = P.p.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this));
|
error = P.p.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this));
|
||||||
} else if (forFaction == currentFaction) {
|
} else if (forFaction == currentFaction) {
|
||||||
|
Loading…
Reference in New Issue
Block a user