Swapping money commands back to using EconomyParticipator instead of Faction/FPlayer

This commit is contained in:
Brettflan 2011-10-23 13:14:51 -05:00
parent f8f3704cd4
commit 136b69b07f
5 changed files with 29 additions and 20 deletions

View File

@ -1,11 +1,13 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission;
import org.bukkit.ChatColor;
public class CmdMoneyDeposit extends FCommand
{
@ -32,12 +34,12 @@ public class CmdMoneyDeposit extends FCommand
public void perform()
{
double amount = this.argAsDouble(0, 0d);
Faction faction = this.argAsFaction(1, myFaction);
EconomyParticipator faction = this.argAsFaction(1, myFaction);
if (faction == null) return;
Econ.transferMoney(fme, fme, faction, amount);
if (Conf.logMoneyTransactions)
P.p.log(fme.getName()+" deposited "+Econ.moneyString(amount)+" into the faction bank: "+faction.getTag());
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s deposited %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
}
}

View File

@ -1,11 +1,13 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission;
import org.bukkit.ChatColor;
public class CmdMoneyTransferFf extends FCommand
{
@ -32,14 +34,14 @@ public class CmdMoneyTransferFf extends FCommand
public void perform()
{
double amount = this.argAsDouble(0, 0d);
Faction from = this.argAsFaction(1);
EconomyParticipator from = this.argAsFaction(1);
if (from == null) return;
Faction to = this.argAsFaction(2);
EconomyParticipator to = this.argAsFaction(2);
if (to == null) return;
Econ.transferMoney(fme, from, to, amount);
if (Conf.logMoneyTransactions)
P.p.log(fme.getName()+" transferred "+Econ.moneyString(amount)+" from the faction \""+from.getTag()+"\" to the faction \""+to.getTag()+"\"");
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
}
}

View File

@ -1,12 +1,13 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission;
import org.bukkit.ChatColor;
public class CmdMoneyTransferFp extends FCommand
{
@ -33,14 +34,14 @@ public class CmdMoneyTransferFp extends FCommand
public void perform()
{
double amount = this.argAsDouble(0, 0d);
Faction from = this.argAsFaction(1);
EconomyParticipator from = this.argAsFaction(1);
if (from == null) return;
FPlayer to = this.argAsBestFPlayerMatch(2);
EconomyParticipator to = this.argAsBestFPlayerMatch(2);
if (to == null) return;
Econ.transferMoney(fme, from, to, amount);
if (Conf.logMoneyTransactions)
P.p.log(fme.getName()+" transferred "+Econ.moneyString(amount)+" from the faction \""+from.getTag()+"\" to the player \""+to.getName()+"\"");
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
}
}

View File

@ -1,12 +1,13 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission;
import org.bukkit.ChatColor;
public class CmdMoneyTransferPf extends FCommand
{
@ -33,14 +34,14 @@ public class CmdMoneyTransferPf extends FCommand
public void perform()
{
double amount = this.argAsDouble(0, 0d);
FPlayer from = this.argAsBestFPlayerMatch(1);
EconomyParticipator from = this.argAsBestFPlayerMatch(1);
if (from == null) return;
Faction to = this.argAsFaction(2);
EconomyParticipator to = this.argAsFaction(2);
if (to == null) return;
Econ.transferMoney(fme, from, to, amount);
if (Conf.logMoneyTransactions)
P.p.log(fme.getName()+" transferred "+Econ.moneyString(amount)+" from the player \""+from.getName()+"\" to the faction \""+to.getTag()+"\"");
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
}
}

View File

@ -1,11 +1,14 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission;
import org.bukkit.ChatColor;
public class CmdMoneyWithdraw extends FCommand
{
public CmdMoneyWithdraw()
@ -29,11 +32,11 @@ public class CmdMoneyWithdraw extends FCommand
public void perform()
{
double amount = this.argAsDouble(0, 0d);
Faction faction = this.argAsFaction(1, myFaction);
EconomyParticipator faction = this.argAsFaction(1, myFaction);
if (faction == null) return;
Econ.transferMoney(fme, faction, fme, amount);
if (Conf.logMoneyTransactions)
P.p.log(fme.getName()+" withdrew "+Econ.moneyString(amount)+" from the faction bank: "+faction.getTag());
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
}
}