mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-09-10 20:29:28 +00: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 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,13 +150,13 @@ public class Commandeco extends EssentialsCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue