Check for zero money on faction disband

The takeOnDisband method of EngineEcon now checks if the amount of money
to be transferred to the player upon disbanding a faction is 0. If this is
the case, the method exits.

This will prevent unnecessary operations in transferring money to players
(which could be expensive if the economy is hooked to a database, for
example).
This commit is contained in:
daviga404 2016-02-17 16:55:22 +00:00 committed by Olof Larsson
parent 99bb301e0d
commit 33e1d7749b

View File

@ -82,6 +82,10 @@ public class EngineEcon extends Engine
Faction faction = event.getFaction(); Faction faction = event.getFaction();
double amount = Money.get(faction); double amount = Money.get(faction);
// Check that there is an amount
if (amount == 0) return;
String amountString = Money.format(amount); String amountString = Money.format(amount);
Econ.transferMoney(faction, mplayer, mplayer, amount, true); Econ.transferMoney(faction, mplayer, mplayer, amount, true);