diff options
author | KHobbits <rob@khobbits.co.uk> | 2013-01-20 01:19:52 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-01-20 01:24:09 +0000 |
commit | 987b2ff4d573d7f49adee899d69b6a46d1faa969 (patch) | |
tree | 33d72ac2a1d6eb094674cf3be3fcb7c9b67b89c8 | |
parent | 23a15cb11a9ca3de2a6f22142abf767082815bf6 (diff) | |
download | Essentials-987b2ff4d573d7f49adee899d69b6a46d1faa969.tar Essentials-987b2ff4d573d7f49adee899d69b6a46d1faa969.tar.gz Essentials-987b2ff4d573d7f49adee899d69b6a46d1faa969.tar.lz Essentials-987b2ff4d573d7f49adee899d69b6a46d1faa969.tar.xz Essentials-987b2ff4d573d7f49adee899d69b6a46d1faa969.zip |
Minor cleanup on /eco command.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandeco.java | 22 | ||||
-rw-r--r-- | Essentials/src/messages.properties | 4 | ||||
-rw-r--r-- | Essentials/src/messages_en.properties | 4 |
3 files changed, 16 insertions, 14 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java index 6b2a31c9e..6f46f0e00 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import java.util.Locale; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -18,10 +19,9 @@ public class Commandeco extends EssentialsCommand @Override public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { - boolean broadcast = false; - boolean broadcastAll = false; + Double broadcast = null; + Double broadcastAll = null; final double startingBalance = (double)ess.getSettings().getStartingBalance(); - final String start = ess.getSettings().getCurrencySymbol() + ess.getSettings().getStartingBalance(); if (args.length < 2) { throw new NotEnoughArgumentsException(); @@ -67,12 +67,13 @@ public class Commandeco extends EssentialsCommand case RESET: player.setMoney(startingBalance); - broadcastAll = true; + broadcastAll = startingBalance; break; case SET: boolean underMinimum = (player.getMoney() - amount) < minBalance; player.setMoney(underMinimum ? minBalance : amount); + broadcastAll = underMinimum ? minBalance : amount; break; } } @@ -104,12 +105,13 @@ public class Commandeco extends EssentialsCommand case RESET: player.setMoney(startingBalance); - broadcast = true; + broadcast = startingBalance; break; case SET: boolean underMinimum = (player.getMoney() - amount) < minBalance; player.setMoney(underMinimum ? minBalance : amount); + broadcast = underMinimum ? minBalance : amount; break; } } @@ -147,14 +149,14 @@ public class Commandeco extends EssentialsCommand break; } } - - if(broadcast) + + if (broadcast != null) { - server.broadcastMessage(_("resetBal", start)); + server.broadcastMessage(_("resetBal", Util.formatAsCurrency(broadcast))); } - if(broadcastAll) + if (broadcastAll != null) { - server.broadcastMessage(_("resetBalAll", start)); + server.broadcastMessage(_("resetBalAll", Util.formatAsCurrency(broadcastAll))); } } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 1a0fdb01f..0727fac9f 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -490,5 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} -resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players -resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players +resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players +resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 1a0fdb01f..c6b1df86e 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -490,5 +490,5 @@ fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} -resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players -resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players +resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players +resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players
\ No newline at end of file |