Set warp and f warp f perms

This commit is contained in:
Trent Hensler
2018-02-03 13:04:21 -08:00
parent ad10222c2d
commit 1b088ccd54
3 changed files with 32 additions and 2 deletions

View File

@@ -4,20 +4,27 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.util.LazyLocation;
import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL;
public class CmdSetFWarp extends FCommand {
public CmdSetFWarp() {
super();
this.aliases.add("setwarp");
this.aliases.add("sw");
this.requiredArgs.add("warp name");
this.optionalArgs.put("password", "password");
this.senderMustBeMember = true;
this.senderMustBeModerator = true;
this.senderMustBeModerator = false;
this.senderMustBePlayer = true;
this.permission = Permission.SETWARP.node;
}
@@ -28,6 +35,14 @@ public class CmdSetFWarp extends FCommand {
return;
}
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;
}
int maxWarps = P.p.getConfig().getInt("max-warps", 5);
if (maxWarps <= myFaction.getWarps().size()) {
fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps);