From a4ff2abd5cd711486edd3391a9deb8b9aee74a55 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 18 Sep 2014 00:18:07 +0200 Subject: [PATCH] Sync MConf at once on update. Also don't transfer 0 money on disband. --- .../massivecraft/factions/listeners/FactionsListenerEcon.java | 4 +++- .../java/com/massivecraft/factions/update/UpdateUtil.java | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsListenerEcon.java b/src/main/java/com/massivecraft/factions/listeners/FactionsListenerEcon.java index 6c18e151..d51909f8 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsListenerEcon.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsListenerEcon.java @@ -62,7 +62,9 @@ public class FactionsListenerEcon implements Listener if (oldFaction.getMPlayers().size() > 1) return; // ... then transfer all money to the player. - Econ.transferMoney(mplayer, oldFaction, mplayer, Money.get(oldFaction)); + double money = Money.get(oldFaction); + if (money == 0) return; + Econ.transferMoney(mplayer, oldFaction, mplayer, money); } // -------------------------------------------- // diff --git a/src/main/java/com/massivecraft/factions/update/UpdateUtil.java b/src/main/java/com/massivecraft/factions/update/UpdateUtil.java index 3ebd6467..d45ed04c 100644 --- a/src/main/java/com/massivecraft/factions/update/UpdateUtil.java +++ b/src/main/java/com/massivecraft/factions/update/UpdateUtil.java @@ -45,6 +45,8 @@ public class UpdateUtil // ... transfer the old uconf data over to the new mconf ... oldConf.transferTo(MConf.get()); + MConf.get().changed(); + MConf.get().sync(); // ... rename target collections ... Db db = MStore.getDb();