Introduced Brigadier Command System. More Formatting Coming in next commit.

This commit is contained in:
Driftay
2019-09-14 15:13:01 -04:00
parent b06e6e0f04
commit 3c9b606bb9
207 changed files with 4465 additions and 4017 deletions

View File

@@ -1,7 +1,9 @@
package com.massivecraft.factions.cmd.econ;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.P;
import com.massivecraft.factions.FactionsPlugin;
import com.massivecraft.factions.cmd.CommandContext;
import com.massivecraft.factions.cmd.CommandRequirements;
import com.massivecraft.factions.cmd.FCommand;
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.integration.Econ;
@@ -13,6 +15,7 @@ import org.bukkit.entity.Player;
public class CmdMoneyTransferFf extends FCommand {
public CmdMoneyTransferFf() {
this.aliases.add("ff");
@@ -20,45 +23,32 @@ public class CmdMoneyTransferFf extends FCommand {
this.requiredArgs.add("faction");
this.requiredArgs.add("faction");
//this.optionalArgs.put("", "");
this.permission = Permission.MONEY_F2F.node;
this.isMoneyCommand = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
this.requirements = new CommandRequirements.Builder(Permission.MONEY_F2F).build();
}
@Override
public void perform() {
double amount = this.argAsDouble(0, 0d);
EconomyParticipator from = this.argAsFaction(1);
public void perform(CommandContext context) {
double amount = context.argAsDouble(0, 0d);
EconomyParticipator from = context.argAsFaction(1);
if (from == null) {
return;
}
EconomyParticipator to = this.argAsFaction(2);
EconomyParticipator to = context.argAsFaction(2);
if (to == null) {
return;
}
if (Conf.econFactionStartingBalance != 0 && (System.currentTimeMillis() - myFaction.getFoundedDate()) <= (Conf.econDenyWithdrawWhenMinutesAgeLessThan * 6000)) {
msg("Your faction is too young to transfer money like this");
return;
}
boolean success = Econ.transferMoney(fme, from, to, amount);
boolean success = Econ.transferMoney(context.fPlayer, from, to, amount);
if (success && Conf.logMoneyTransactions) {
String name = sender instanceof Player ? fme.getName() : sender.getName();
P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYTRANSFERFF_TRANSFER.toString(), name, Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
String name = context.sender instanceof Player ? context.fPlayer.getName() : context.sender.getName();
FactionsPlugin.getInstance().log(ChatColor.stripColor(FactionsPlugin.getInstance().txt.parse(TL.COMMAND_MONEYTRANSFERFF_TRANSFER.toString(), name, Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_MONEYTRANSFERFF_DESCRIPTION;
}
}
}