From 136b69b07f0dc69bea84d9546e2c04855c01bc12 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Sun, 23 Oct 2011 13:14:51 -0500 Subject: [PATCH] Swapping money commands back to using EconomyParticipator instead of Faction/FPlayer --- .../massivecraft/factions/cmd/CmdMoneyDeposit.java | 8 +++++--- .../massivecraft/factions/cmd/CmdMoneyTransferFf.java | 10 ++++++---- .../massivecraft/factions/cmd/CmdMoneyTransferFp.java | 11 ++++++----- .../massivecraft/factions/cmd/CmdMoneyTransferPf.java | 11 ++++++----- .../massivecraft/factions/cmd/CmdMoneyWithdraw.java | 9 ++++++--- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java b/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java index 52183d02..194a27e1 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyDeposit.java @@ -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)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java index ae869825..e21655d7 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java @@ -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)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java index 7887f590..d5be9db7 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java @@ -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)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java b/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java index 5e881cd3..68980cb7 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java @@ -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)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java b/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java index b394e9e0..b31cd5b5 100644 --- a/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java +++ b/src/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java @@ -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)))); } }