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 {
|
|
|
|
|
|
|
|
public CmdSetMaxVaults() {
|
|
|
|
this.aliases.add("setmaxvaults");
|
|
|
|
this.aliases.add("smv");
|
|
|
|
|
|
|
|
this.requiredArgs.add("faction");
|
|
|
|
this.requiredArgs.add("number");
|
|
|
|
|
|
|
|
this.permission = Permission.SETMAXVAULTS.node;
|
|
|
|
this.disableOnLock = false;
|
|
|
|
|
|
|
|
senderMustBePlayer = false;
|
|
|
|
senderMustBeMember = false;
|
|
|
|
senderMustBeModerator = false;
|
2018-03-26 23:43:15 +02:00
|
|
|
senderMustBeColeader = false;
|
2016-05-31 01:22:45 +02:00
|
|
|
senderMustBeAdmin = false;
|
2018-12-21 22:46:10 +01:00
|
|
|
|
2016-05-31 01:22:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
Faction targetFaction = argAsFaction(0);
|
2019-02-11 05:57:45 +01:00
|
|
|
int value = argAsInt(1, -1);
|
2018-01-05 02:17:26 +01:00
|
|
|
if (value < 0) {
|
2016-05-31 01:22:45 +02:00
|
|
|
sender.sendMessage(ChatColor.RED + "Number must be greater than 0.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-01-05 02:17:26 +01:00
|
|
|
if (targetFaction == null) {
|
2016-05-31 01:22:45 +02:00
|
|
|
sender.sendMessage(ChatColor.RED + "Couldn't find Faction: " + ChatColor.YELLOW + argAsString(0));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
targetFaction.setMaxVaults(value);
|
|
|
|
sender.sendMessage(TL.COMMAND_SETMAXVAULTS_SUCCESS.format(targetFaction.getTag(), value));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_SETMAXVAULTS_DESCRIPTION;
|
|
|
|
}
|
|
|
|
}
|