mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-04 19:46:27 +00:00
Minor cleanup on /eco command.
This commit is contained in:
parent
23a15cb11a
commit
987b2ff4d5
3 changed files with 16 additions and 14 deletions
|
@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -18,10 +19,9 @@ public class Commandeco extends EssentialsCommand
|
||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
boolean broadcast = false;
|
Double broadcast = null;
|
||||||
boolean broadcastAll = false;
|
Double broadcastAll = null;
|
||||||
final double startingBalance = (double)ess.getSettings().getStartingBalance();
|
final double startingBalance = (double)ess.getSettings().getStartingBalance();
|
||||||
final String start = ess.getSettings().getCurrencySymbol() + ess.getSettings().getStartingBalance();
|
|
||||||
if (args.length < 2)
|
if (args.length < 2)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
|
@ -67,12 +67,13 @@ public class Commandeco extends EssentialsCommand
|
||||||
|
|
||||||
case RESET:
|
case RESET:
|
||||||
player.setMoney(startingBalance);
|
player.setMoney(startingBalance);
|
||||||
broadcastAll = true;
|
broadcastAll = startingBalance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SET:
|
case SET:
|
||||||
boolean underMinimum = (player.getMoney() - amount) < minBalance;
|
boolean underMinimum = (player.getMoney() - amount) < minBalance;
|
||||||
player.setMoney(underMinimum ? minBalance : amount);
|
player.setMoney(underMinimum ? minBalance : amount);
|
||||||
|
broadcastAll = underMinimum ? minBalance : amount;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,12 +105,13 @@ public class Commandeco extends EssentialsCommand
|
||||||
|
|
||||||
case RESET:
|
case RESET:
|
||||||
player.setMoney(startingBalance);
|
player.setMoney(startingBalance);
|
||||||
broadcast = true;
|
broadcast = startingBalance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SET:
|
case SET:
|
||||||
boolean underMinimum = (player.getMoney() - amount) < minBalance;
|
boolean underMinimum = (player.getMoney() - amount) < minBalance;
|
||||||
player.setMoney(underMinimum ? minBalance : amount);
|
player.setMoney(underMinimum ? minBalance : amount);
|
||||||
|
broadcast = underMinimum ? minBalance : amount;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,14 +149,14 @@ public class Commandeco extends EssentialsCommand
|
||||||
break;
|
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
|
holdFirework=\u00a74You must be holding a firework to add effects
|
||||||
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
|
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
|
||||||
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
|
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
|
||||||
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
|
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players
|
||||||
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all 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
|
holdFirework=\u00a74You must be holding a firework to add effects
|
||||||
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
|
invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1}
|
||||||
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
|
muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
|
||||||
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players
|
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players
|
||||||
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
|
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players
|
Loading…
Add table
Add a link
Reference in a new issue