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;
@@ -19,39 +21,25 @@ public class CmdMoneyTransferPf extends FCommand {
this.requiredArgs.add("player");
this.requiredArgs.add("faction");
//this.optionalArgs.put("", "");
this.permission = Permission.MONEY_P2F.node;
this.isMoneyCommand = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
this.requirements = new CommandRequirements.Builder(Permission.MONEY_P2F).build();
}
@Override
public void perform() {
double amount = this.argAsDouble(0, 0d);
EconomyParticipator from = this.argAsBestFPlayerMatch(1);
public void perform(CommandContext context) {
double amount = context.argAsDouble(0, 0d);
EconomyParticipator from = context.argAsBestFPlayerMatch(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) {
P.p.log(ChatColor.stripColor(P.p.txt.parse(TL.COMMAND_MONEYTRANSFERPF_TRANSFER.toString(), fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
FactionsPlugin.getInstance().log(ChatColor.stripColor(FactionsPlugin.getInstance().txt.parse(TL.COMMAND_MONEYTRANSFERPF_TRANSFER.toString(), context.fPlayer.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
}
}