diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java b/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java index d2d4a6d7..6457cdf4 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java @@ -104,13 +104,13 @@ public class CmdFactionsFaction extends FCommand money *= -1; } - msg("Total land %s %s: %s", type.toString().toLowerCase(), word, Money.format(faction, money)); + msg("Total land %s %s: %s", type.toString().toLowerCase(), word, Money.format(money)); } // Show bank contents if (UConf.get(faction).bankEnabled) { - msg("Bank contains: "+Money.format(faction, Money.get(faction))); + msg("Bank contains: "+Money.format(Money.get(faction))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java index bc7e1029..47df2cb2 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyDeposit.java @@ -53,7 +53,7 @@ public class CmdFactionsMoneyDeposit extends FCommand if (success && MConf.get().logMoneyTransactions) { - Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", usender.getName(), Money.format(usender, amount), faction.describeTo(null)))); + Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", usender.getName(), Money.format(amount), faction.describeTo(null)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java index 72bb6840..e6a0f305 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFf.java @@ -58,7 +58,7 @@ public class CmdFactionsMoneyTransferFf extends FCommand if (success && MConf.get().logMoneyTransactions) { - Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null)))); + Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java index a80a66aa..02e3255c 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferFp.java @@ -60,7 +60,7 @@ public class CmdFactionsMoneyTransferFp extends FCommand if (success && MConf.get().logMoneyTransactions) { - Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null)))); + Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java index 86fb0364..64db97a2 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyTransferPf.java @@ -60,7 +60,7 @@ public class CmdFactionsMoneyTransferPf extends FCommand if (success && MConf.get().logMoneyTransactions) { - Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null)))); + Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null)))); } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java index 7d397a91..16a00b71 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMoneyWithdraw.java @@ -57,7 +57,7 @@ public class CmdFactionsMoneyWithdraw extends FCommand if (success && MConf.get().logMoneyTransactions) { - Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", usender.getName(), Money.format(from, amount), from.describeTo(null)))); + Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", usender.getName(), Money.format(amount), from.describeTo(null)))); } } diff --git a/src/com/massivecraft/factions/entity/Faction.java b/src/com/massivecraft/factions/entity/Faction.java index 7a4344b0..93caab76 100644 --- a/src/com/massivecraft/factions/entity/Faction.java +++ b/src/com/massivecraft/factions/entity/Faction.java @@ -60,7 +60,7 @@ public class Faction extends Entity implements EconomyParticipator @Override public void preDetach(String id) { - Money.set(this, 0); + Money.set(0, null, this); String universe = this.getUniverse(); diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index a46fa6ce..421ea125 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -21,7 +21,7 @@ public class Econ // TODO: Could we not have it enabled as long as Money.enabled is true? public static boolean isEnabled(Object universe) { - return UConf.get(universe).econEnabled && Money.enabled(universe); + return UConf.get(universe).econEnabled && Money.enabled(); } // -------------------------------------------- // @@ -59,14 +59,14 @@ public class Econ if (uconf.econUniverseAccount == null) return; if (uconf.econUniverseAccount.length() == 0) return; - if (!Money.exists(universe, uconf.econUniverseAccount)) return; + if (!Money.exists(uconf.econUniverseAccount)) return; - Money.add(universe, uconf.econUniverseAccount, delta); + Money.spawn(delta, null, uconf.econUniverseAccount); } public static void sendBalanceInfo(UPlayer to, EconomyParticipator about) { - to.msg("%s's balance is %s.", about.describeTo(to, true), Money.format(about, Money.get(about))); + to.msg("%s's balance is %s.", about.describeTo(to, true), Money.format(Money.get(about))); } public static boolean canIControllYou(EconomyParticipator i, EconomyParticipator you) @@ -127,15 +127,15 @@ public class Econ // There was not enough money to pay if (invoker != null && notify) { - invoker.msg("%s can't afford to transfer %s to %s.", from.describeTo(invoker, true), Money.format(from, amount), to.describeTo(invoker)); + invoker.msg("%s can't afford to transfer %s to %s.", from.describeTo(invoker, true), Money.format(amount), to.describeTo(invoker)); } return false; } // Transfer money - if (Money.subtract(from, amount)) + if (Money.despawn(amount, null, from)) { - if (Money.add(to, amount)) + if (Money.spawn(amount, null, to)) { if (notify) { @@ -146,14 +146,14 @@ public class Econ else { // We failed. Try a rollback - Money.add(from, amount); + Money.spawn(amount, null, from); } } // if we get here something with the transaction failed if (notify) { - invoker.msg("Unable to transfer %s to %s from %s.", Money.format(from, amount), to.describeTo(invoker), from.describeTo(invoker, true)); + invoker.msg("Unable to transfer %s to %s from %s.", Money.format(amount), to.describeTo(invoker), from.describeTo(invoker, true)); } return false; @@ -190,28 +190,28 @@ public class Econ { for (UPlayer recipient : recipients) { - recipient.msg("%s was transfered from %s to %s.", Money.format(from, amount), from.describeTo(recipient), to.describeTo(recipient)); + recipient.msg("%s was transfered from %s to %s.", Money.format(amount), from.describeTo(recipient), to.describeTo(recipient)); } } else if (invoker == from) { for (UPlayer recipient : recipients) { - recipient.msg("%s gave %s to %s.", from.describeTo(recipient, true), Money.format(from, amount), to.describeTo(recipient)); + recipient.msg("%s gave %s to %s.", from.describeTo(recipient, true), Money.format(amount), to.describeTo(recipient)); } } else if (invoker == to) { for (UPlayer recipient : recipients) { - recipient.msg("%s took %s from %s.", to.describeTo(recipient, true), Money.format(from, amount), from.describeTo(recipient)); + recipient.msg("%s took %s from %s.", to.describeTo(recipient, true), Money.format(amount), from.describeTo(recipient)); } } else { for (UPlayer recipient : recipients) { - recipient.msg("%s transfered %s from %s to %s.", invoker.describeTo(recipient, true), Money.format(from, amount), from.describeTo(recipient), to.describeTo(recipient)); + recipient.msg("%s transfered %s from %s to %s.", invoker.describeTo(recipient, true), Money.format(amount), from.describeTo(recipient), to.describeTo(recipient)); } } } @@ -224,7 +224,7 @@ public class Econ { if (toDoThis != null && !toDoThis.isEmpty()) { - ep.msg("%s can't afford %s %s.", ep.describeTo(ep, true), Money.format(ep, delta), toDoThis); + ep.msg("%s can't afford %s %s.", ep.describeTo(ep, true), Money.format(delta), toDoThis); } return false; } @@ -240,7 +240,7 @@ public class Econ boolean hasActionDesctription = (actionDescription != null && !actionDescription.isEmpty()); - if (Money.add(ep, delta)) + if (Money.spawn(delta, null, ep)) { modifyUniverseMoney(ep, -delta); @@ -248,11 +248,11 @@ public class Econ { if (delta > 0) { - ep.msg("%s gained %s since did %s.", You, Money.format(ep, delta), actionDescription); + ep.msg("%s gained %s since did %s.", You, Money.format(delta), actionDescription); } else { - ep.msg("%s lost %s since did %s.", You, Money.format(ep, -delta), actionDescription); + ep.msg("%s lost %s since did %s.", You, Money.format(-delta), actionDescription); } } return true; @@ -263,11 +263,11 @@ public class Econ { if (delta > 0) { - ep.msg("%s would have gained %s since did %s, but the deposit failed.", You, Money.format(ep, delta), actionDescription); + ep.msg("%s would have gained %s since did %s, but the deposit failed.", You, Money.format(delta), actionDescription); } else { - ep.msg("%s can't afford %s to %s.", You, Money.format(ep, -delta), actionDescription); + ep.msg("%s can't afford %s to %s.", You, Money.format(-delta), actionDescription); } } return false; diff --git a/src/com/massivecraft/factions/listeners/FactionsListenerEcon.java b/src/com/massivecraft/factions/listeners/FactionsListenerEcon.java index 7fd0fc12..987a2719 100644 --- a/src/com/massivecraft/factions/listeners/FactionsListenerEcon.java +++ b/src/com/massivecraft/factions/listeners/FactionsListenerEcon.java @@ -83,7 +83,7 @@ public class FactionsListenerEcon implements Listener Faction faction = event.getFaction(); double amount = Money.get(faction); - String amountString = Money.format(faction, amount); + String amountString = Money.format(amount); Econ.transferMoney(usender, faction, usender, amount, true);