Add command to set default rank. Only used by admins.
/f defaultrole <role>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdSetDefaultRole extends FCommand {
|
||||
|
||||
public CmdSetDefaultRole() {
|
||||
super();
|
||||
|
||||
this.aliases.add("defaultrole");
|
||||
this.aliases.add("defaultrank");
|
||||
this.aliases.add("default");
|
||||
this.aliases.add("def");
|
||||
this.requiredArgs.add("role");
|
||||
|
||||
this.senderMustBeMember = true;
|
||||
this.senderMustBeAdmin = true;
|
||||
this.senderMustBePlayer = true;
|
||||
|
||||
this.permission = Permission.DEFAULTRANK.node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
Role target = Role.fromString(argAsString(0).toUpperCase());
|
||||
if (target == null) {
|
||||
msg(TL.COMMAND_SETDEFAULTROLE_INVALIDROLE, argAsString(0));
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction.setDefaultRole(target);
|
||||
msg(TL.COMMAND_SETDEFAULTROLE_SUCCESS, target.nicename);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_SETDEFAULTROLE_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,7 @@ public class FCmdRoot extends FCommand {
|
||||
public CmdPerm cmdPerm = new CmdPerm();
|
||||
public CmdPromote cmdPromote = new CmdPromote();
|
||||
public CmdDemote cmdDemote = new CmdDemote();
|
||||
public CmdSetDefaultRole cmdSetDefaultRole = new CmdSetDefaultRole();
|
||||
|
||||
public FCmdRoot() {
|
||||
super();
|
||||
@@ -160,6 +161,7 @@ public class FCmdRoot extends FCommand {
|
||||
this.addSubCommand(this.cmdPerm);
|
||||
this.addSubCommand(this.cmdPromote);
|
||||
this.addSubCommand(this.cmdDemote);
|
||||
this.addSubCommand(this.cmdSetDefaultRole);
|
||||
if (P.p.isHookedPlayervaults()) {
|
||||
P.p.log("Found playervaults hook, adding /f vault and /f setmaxvault commands.");
|
||||
this.addSubCommand(new CmdSetMaxVaults());
|
||||
|
||||
Reference in New Issue
Block a user