2018-01-05 02:37:21 +01:00
|
|
|
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.senderMustBeAdmin = true;
|
|
|
|
this.senderMustBePlayer = true;
|
2018-03-26 23:43:15 +02:00
|
|
|
senderMustBeColeader = false;
|
2018-01-05 02:37:21 +01:00
|
|
|
|
2018-12-21 22:46:10 +01:00
|
|
|
|
2019-02-11 05:57:45 +01:00
|
|
|
this.permission = Permission.DEFAULTRANK.node;
|
2018-01-05 02:37:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
Role target = Role.fromString(argAsString(0).toUpperCase());
|
|
|
|
if (target == null) {
|
|
|
|
msg(TL.COMMAND_SETDEFAULTROLE_INVALIDROLE, argAsString(0));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-11-07 06:38:43 +01:00
|
|
|
if (target == Role.LEADER) {
|
2018-01-05 02:38:29 +01:00
|
|
|
msg(TL.COMMAND_SETDEFAULTROLE_NOTTHATROLE, argAsString(0));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-07-18 16:48:25 +02:00
|
|
|
|
2018-01-05 02:37:21 +01:00
|
|
|
myFaction.setDefaultRole(target);
|
|
|
|
msg(TL.COMMAND_SETDEFAULTROLE_SUCCESS, target.nicename);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_SETDEFAULTROLE_DESCRIPTION;
|
|
|
|
}
|
|
|
|
}
|