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
commit62b4348842ee4ac8d79d43142f343adf48555af4 (patch)
tree90720e3be5e13294af47cf825dc8d489c7eda44d
parenteca3be5cf3e421936271b7395236eec51b573cd4 (diff)
downloadEssentials-62b4348842ee4ac8d79d43142f343adf48555af4.tar
Essentials-62b4348842ee4ac8d79d43142f343adf48555af4.tar.gz
Essentials-62b4348842ee4ac8d79d43142f343adf48555af4.tar.lz
Essentials-62b4348842ee4ac8d79d43142f343adf48555af4.tar.xz
Essentials-62b4348842ee4ac8d79d43142f343adf48555af4.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);
+ }
}
}