Explicit permission checks and more admin bypasses

This commit is contained in:
Svenja Reissaus
2018-08-02 14:55:21 -03:00
parent 85de278dc9
commit 5fe55afc68
18 changed files with 105 additions and 101 deletions

View File

@@ -38,11 +38,15 @@ public class CmdSetFWarp extends FCommand {
Access access = myFaction.getAccess(fme, PermissableAction.SETWARP);
// This statement allows us to check if they've specifically denied it, or default to
// the old setting of allowing moderators to set warps.
if (access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.MODERATOR))) {
fme.msg(TL.GENERIC_NOPERMISSION, "set warp");
return;
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.SETWARP);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set warps");
return;
}
}
int maxWarps = P.p.getConfig().getInt("max-warps", 5);
if (maxWarps <= myFaction.getWarps().size()) {
fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps);