From cace4aa95512b26c7e69e4b8cb50da7be40c9ac3 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Wed, 12 Oct 2011 23:44:59 -0500 Subject: [PATCH] Fix for faction not being disbanded properly when last player leaves Fix for some NoClassDefFoundErrors when Register plugin isn't present and certain economy functions are used --- src/com/massivecraft/factions/FPlayer.java | 12 ++++++------ src/com/massivecraft/factions/integration/Econ.java | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/com/massivecraft/factions/FPlayer.java b/src/com/massivecraft/factions/FPlayer.java index 2bd56984..c1223d1a 100644 --- a/src/com/massivecraft/factions/FPlayer.java +++ b/src/com/massivecraft/factions/FPlayer.java @@ -622,22 +622,22 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator } } + this.resetFactionData(); + if (myFaction.isNormal() && !perm && myFaction.getFPlayers().isEmpty()) { // Transfer all money - Econ.transferMoney(this, myFaction, this, myFaction.getAccount().balance()); - + if (Econ.shouldBeUsed()) + Econ.transferMoney(this, myFaction, this, myFaction.getAccount().balance()); + // Remove this faction for (FPlayer fplayer : FPlayers.i.getOnline()) { fplayer.msg("%s was disbanded.", myFaction.describeTo(fplayer, true)); } - //Faction.delete(myFaction.getId()); - + myFaction.detach(); } - - this.resetFactionData(); } public boolean attemptClaim(boolean notifyFailure) diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index 366f1ad3..bc85f481 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -69,6 +69,8 @@ public class Econ public static void modifyUniverseMoney(double delta) { + if (!shouldBeUsed()) return; + MethodAccount acc = getUniverseAccount(); if (acc == null) return; acc.add(delta); @@ -103,6 +105,8 @@ public class Econ public static boolean transferMoney(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount) { + if ( ! shouldBeUsed()) return false; + // The amount must be positive. // If the amount is negative we must flip and multiply amount with -1. if (amount < 0) @@ -161,6 +165,8 @@ public class Econ public static boolean modifyMoney(EconomyParticipator ep, double delta, String toDoThis, String forDoingThis) { + if ( ! shouldBeUsed()) return false; + MethodAccount acc = ep.getAccount(); String You = ep.describeTo(ep, true);