mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-30 21:17:38 +01:00
Minor cleanup on /eco command.
This commit is contained in:
parent
23a15cb11a
commit
987b2ff4d5
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user