mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Throw syntax error instead of "For input string"
This commit is contained in:
parent
a14104c529
commit
29ea24f715
2 changed files with 30 additions and 16 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
|
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
@ -56,7 +57,12 @@ public class Worth implements IConf
|
||||||
|
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
amount = Integer.parseInt(args[1].replaceAll("[^0-9]", ""));
|
amount = Integer.parseInt(args[1].replaceAll("[^0-9]", ""));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ex) {
|
||||||
|
throw new NotEnoughArgumentsException(ex);
|
||||||
|
}
|
||||||
if (args[1].startsWith("-"))
|
if (args[1].startsWith("-"))
|
||||||
{
|
{
|
||||||
amount = -amount;
|
amount = -amount;
|
||||||
|
|
|
@ -88,9 +88,17 @@ public class Commandworth extends EssentialsCommand
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
amount = Integer.parseInt(args[1].replaceAll("[^0-9]", ""));
|
amount = Integer.parseInt(args[1].replaceAll("[^0-9]", ""));
|
||||||
}
|
}
|
||||||
|
catch (NumberFormatException ex)
|
||||||
|
{
|
||||||
|
throw new NotEnoughArgumentsException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue