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:
parent
99bb301e0d
commit
33e1d7749b
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user