diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-03-04 09:20:03 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-03-05 08:37:14 +0000 |
commit | b16a1f7237f58a3c7728bc238923fb90e218659e (patch) | |
tree | ce9d1a1c279890025a83af11c24d128316a9c592 | |
parent | e28f1b1be3bf9a44a0eb4c4116a9a166cec7be20 (diff) | |
download | Essentials-b16a1f7237f58a3c7728bc238923fb90e218659e.tar Essentials-b16a1f7237f58a3c7728bc238923fb90e218659e.tar.gz Essentials-b16a1f7237f58a3c7728bc238923fb90e218659e.tar.lz Essentials-b16a1f7237f58a3c7728bc238923fb90e218659e.tar.xz Essentials-b16a1f7237f58a3c7728bc238923fb90e218659e.zip |
Adding option to modify all users balances (including offline) /eco reset ** <amount>
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandeco.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java index b9694ee49..dd6d6ad0d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java @@ -34,7 +34,31 @@ public class Commandeco extends EssentialsCommand throw new NotEnoughArgumentsException(ex); } - if (args[1].contentEquals("*")) + if (args[1].contentEquals("**")) + { + for (String sUser : ess.getUserMap().getAllUniqueUsers()) + { + final User player = ess.getUser(sUser); + switch (cmd) + { + case GIVE: + player.giveMoney(amount); + break; + + case TAKE: + if (player.canAfford(amount, false)) + { + player.takeMoney(amount); + } + break; + + case RESET: + player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount); + break; + } + } + } + else if (args[1].contentEquals("*")) { for (Player onlinePlayer : server.getOnlinePlayers()) { |