From f6d601446e3d36af04cc4ba5a917faf9b1bba791 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 26 Apr 2013 08:02:32 +0200 Subject: [PATCH] Some bugfixes --- src/com/massivecraft/factions/Factions.java | 4 ++++ .../massivecraft/factions/cmd/CmdFactionsShow.java | 3 ++- .../factions/cmd/req/ReqBankCommandsEnabled.java | 7 ++++--- src/com/massivecraft/factions/integration/Econ.java | 12 +++--------- .../factions/listeners/FactionsListenerEcon.java | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/com/massivecraft/factions/Factions.java b/src/com/massivecraft/factions/Factions.java index 5454713e..faf2d81d 100644 --- a/src/com/massivecraft/factions/Factions.java +++ b/src/com/massivecraft/factions/Factions.java @@ -23,6 +23,8 @@ import com.massivecraft.factions.cmd.*; import com.massivecraft.factions.entity.Board; import com.massivecraft.factions.entity.BoardColls; import com.massivecraft.factions.entity.Faction; +import com.massivecraft.factions.entity.MPlayerColl; +import com.massivecraft.factions.entity.UConfColls; import com.massivecraft.factions.entity.UPlayerColls; import com.massivecraft.factions.entity.FactionColls; import com.massivecraft.factions.entity.MConfColl; @@ -109,6 +111,8 @@ public class Factions extends MPlugin // Initialize Database this.databaseInitialized = false; MConfColl.get().init(); + MPlayerColl.get().init(); + UConfColls.get().init(); UPlayerColls.get().init(); FactionColls.get().init(); BoardColls.get().init(); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java index 85f717a1..8c7cce3e 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java @@ -76,7 +76,8 @@ public class CmdFactionsShow extends FCommand for (FactionsEventChunkChangeType type : FactionsEventChunkChangeType.values()) { Double money = uconf.econChunkCost.get(type); - if (money == null) money = 0D; + if (money == null) continue; + if (money == 0D) continue; money *= landCount; String word = null; diff --git a/src/com/massivecraft/factions/cmd/req/ReqBankCommandsEnabled.java b/src/com/massivecraft/factions/cmd/req/ReqBankCommandsEnabled.java index 07c41230..2751ed09 100644 --- a/src/com/massivecraft/factions/cmd/req/ReqBankCommandsEnabled.java +++ b/src/com/massivecraft/factions/cmd/req/ReqBankCommandsEnabled.java @@ -31,11 +31,12 @@ public class ReqBankCommandsEnabled extends ReqAbstract @Override public String createErrorMessage(CommandSender sender, MCommand command) { - if (!UConf.get(sender).bankEnabled) + UConf uconf = UConf.get(sender); + if (!uconf.bankEnabled) { - return Txt.parse("The Factions bank system is disabled on this server."); + return Txt.parse("Faction banks are disabled in the %s universe.", uconf.getUniverse()); } - return Txt.parse("The Factions economy features are disabled on this server."); + return Txt.parse("Faction economy features are disabled in the %s universe.", uconf.getUniverse()); } } diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index 4781ac61..15b2e51c 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -118,9 +118,6 @@ public class Econ if ( ! canIControllYou(invoker, from)) return false; // Is there enough money for the transaction to happen? - - - if (Money.get(from) < amount) { // There was not enough money to pay @@ -132,12 +129,9 @@ public class Econ } // Transfer money - - - if (Money.subtract(from, amount)) { - if (Money.add(from, amount)) + if (Money.add(to, amount)) { if (notify) { @@ -254,7 +248,7 @@ public class Econ } 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(ep, -delta), actionDescription); } } return true; @@ -269,7 +263,7 @@ public class Econ } 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(ep, -delta), actionDescription); } } return false; diff --git a/src/com/massivecraft/factions/listeners/FactionsListenerEcon.java b/src/com/massivecraft/factions/listeners/FactionsListenerEcon.java index 0ac90ccc..7fd0fc12 100644 --- a/src/com/massivecraft/factions/listeners/FactionsListenerEcon.java +++ b/src/com/massivecraft/factions/listeners/FactionsListenerEcon.java @@ -85,7 +85,7 @@ public class FactionsListenerEcon implements Listener double amount = Money.get(faction); String amountString = Money.format(faction, amount); - Econ.transferMoney(usender, faction, usender, amount, false); + Econ.transferMoney(usender, faction, usender, amount, true); usender.msg("You have been given the disbanded faction's bank, totaling %s.", amountString); Factions.get().log(usender.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getName()+".");