2016-05-31 01:22:45 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.Faction;
|
|
|
|
import com.massivecraft.factions.struct.Permission;
|
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
|
|
|
|
public class CmdSetMaxVaults extends FCommand {
|
|
|
|
|
2019-08-24 19:18:50 +02:00
|
|
|
public CmdSetMaxVaults() {
|
|
|
|
this.aliases.add("setmaxvaults");
|
|
|
|
this.aliases.add("smv");
|
|
|
|
this.requiredArgs.add("faction");
|
|
|
|
this.requiredArgs.add("number");
|
|
|
|
|
2019-09-14 21:13:01 +02:00
|
|
|
this.requirements = new CommandRequirements.Builder(Permission.SETMAXVAULTS)
|
|
|
|
.build();
|
2019-08-24 19:18:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-09-14 21:13:01 +02:00
|
|
|
public void perform(CommandContext context) {
|
|
|
|
Faction targetFaction = context.argAsFaction(0);
|
|
|
|
int value = context.argAsInt(1, -1);
|
2019-08-24 19:18:50 +02:00
|
|
|
if (value < 0) {
|
2019-09-14 21:13:01 +02:00
|
|
|
context.sender.sendMessage(ChatColor.RED + "Number must be greater than 0.");
|
2019-08-24 19:18:50 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (targetFaction == null) {
|
2019-09-14 21:13:01 +02:00
|
|
|
context.sender.sendMessage(ChatColor.RED + "Couldn't find Faction: " + ChatColor.YELLOW + context.argAsString(0));
|
2019-08-24 19:18:50 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
targetFaction.setMaxVaults(value);
|
2019-09-14 21:13:01 +02:00
|
|
|
context.sender.sendMessage(TL.COMMAND_SETMAXVAULTS_SUCCESS.format(targetFaction.getTag(), value));
|
2019-08-24 19:18:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_SETMAXVAULTS_DESCRIPTION;
|
|
|
|
}
|
2016-05-31 01:22:45 +02:00
|
|
|
}
|