Add Faction vaults.
These can be accessed with /f vault <number> Set a Faction's max vaults with /f setmaxvaults <faction> <number> - can be run from console so Buycraft can execute it. * This is a not very tested implementation. Should be tested more in depth before being pushed to a release.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
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;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
Faction targetFaction = argAsFaction(0);
|
||||
int value = argAsInt(1, -1);
|
||||
if(value < 0) {
|
||||
sender.sendMessage(ChatColor.RED + "Number must be greater than 0.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(targetFaction == null) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user