summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-08-28 18:00:27 +0100
committerKHobbits <rob@khobbits.co.uk>2013-08-28 18:00:27 +0100
commitfce0d48766cf991a3abbd5c758fc00751e52bddf (patch)
tree54ffc60126ee98ebc07be46763440b993b42def8
parent1a2772dfdc57352b99afb3937cc36e0f518f836e (diff)
downloadEssentials-fce0d48766cf991a3abbd5c758fc00751e52bddf.tar
Essentials-fce0d48766cf991a3abbd5c758fc00751e52bddf.tar.gz
Essentials-fce0d48766cf991a3abbd5c758fc00751e52bddf.tar.lz
Essentials-fce0d48766cf991a3abbd5c758fc00751e52bddf.tar.xz
Essentials-fce0d48766cf991a3abbd5c758fc00751e52bddf.zip
Don't waste cpu on /baltop if eco is disabled.
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java26
2 files changed, 18 insertions, 12 deletions
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index afc59a3d1..99a4f389a 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -457,10 +457,6 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
{
if (ess.getSettings().isEcoDisabled())
{
- if (ess.getSettings().isDebug())
- {
- ess.getLogger().info("Internal economy functions disabled, aborting balance sync.");
- }
return;
}
if (ess.getPaymentMethod().hasMethod() && super.getMoney() != value)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java
index e6a840998..87063bdd8 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java
@@ -109,16 +109,26 @@ public class Commandbalancetop extends EssentialsCommand
cache.getLines().clear();
final Map<String, BigDecimal> balances = new HashMap<String, BigDecimal>();
BigDecimal totalMoney = BigDecimal.ZERO;
- for (String u : ess.getUserMap().getAllUniqueUsers())
+ if (ess.getSettings().isEcoDisabled())
{
- final User user = ess.getUserMap().getUser(u);
- if (user != null)
+ if (ess.getSettings().isDebug())
{
- final BigDecimal userMoney = user.getMoney();
- user.updateMoneyCache(userMoney);
- totalMoney = totalMoney.add(userMoney);
- final String name = user.isHidden() ? user.getName() : user.getDisplayName();
- balances.put(name, userMoney);
+ ess.getLogger().info("Internal economy functions disabled, aborting baltop.");
+ }
+ }
+ else
+ {
+ for (String u : ess.getUserMap().getAllUniqueUsers())
+ {
+ final User user = ess.getUserMap().getUser(u);
+ if (user != null)
+ {
+ final BigDecimal userMoney = user.getMoney();
+ user.updateMoneyCache(userMoney);
+ totalMoney = totalMoney.add(userMoney);
+ final String name = user.isHidden() ? user.getName() : user.getDisplayName();
+ balances.put(name, userMoney);
+ }
}
}