Don't do econ stuff when econ features are disabled

This commit is contained in:
Magnus Ulf 2020-01-15 12:07:04 +01:00
parent e4f0b8e3de
commit bdae7bd68f

View File

@ -50,6 +50,8 @@ public class EngineEcon extends Engine
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void takeOnLeave(EventFactionsMembershipChange event)
{
if (!Econ.isEnabled()) return;
// If a player is leaving the faction ...
if (event.getReason() != MembershipChangeReason.LEAVE) return;
@ -58,7 +60,7 @@ public class EngineEcon extends Engine
Faction oldFaction = mplayer.getFaction();
if (oldFaction.getMPlayers().size() > 1) return;
// ... then transfer all money to the player.
// ... then transfer all money to the player.
double money = Econ.getMoney(oldFaction);
if (money == 0) return;
Econ.transferMoney(mplayer, oldFaction, mplayer, money);