mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 00:58:50 +01:00
Parse /pay modifiers more strictly (#5638)
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
parent
bea43e8798
commit
3203e97a5e
@ -46,25 +46,28 @@ public class Commandpay extends EssentialsLoopCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal tempAmount = new BigDecimal(sanitizedString);
|
BigDecimal tempAmount = new BigDecimal(sanitizedString);
|
||||||
switch (Character.toLowerCase(ogStr.charAt(ogStr.length() - 1))) {
|
switch (ogStr.replace(sanitizedString, "")) {
|
||||||
case 'k': {
|
case "": {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "k": {
|
||||||
tempAmount = tempAmount.multiply(THOUSAND);
|
tempAmount = tempAmount.multiply(THOUSAND);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'm': {
|
case "m": {
|
||||||
tempAmount = tempAmount.multiply(MILLION);
|
tempAmount = tempAmount.multiply(MILLION);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'b': {
|
case "b": {
|
||||||
tempAmount = tempAmount.multiply(BILLION);
|
tempAmount = tempAmount.multiply(BILLION);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 't': {
|
case "t": {
|
||||||
tempAmount = tempAmount.multiply(TRILLION);
|
tempAmount = tempAmount.multiply(TRILLION);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
break;
|
throw new InvalidModifierException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import net.ess3.api.TranslatableException;
|
||||||
|
|
||||||
|
public class InvalidModifierException extends TranslatableException {
|
||||||
|
public InvalidModifierException() {
|
||||||
|
super("invalidModifier");
|
||||||
|
}
|
||||||
|
}
|
@ -550,6 +550,7 @@ invalidHome=<dark_red>Home<secondary> {0} <dark_red>doesn''t exist\!
|
|||||||
invalidHomeName=<dark_red>Invalid home name\!
|
invalidHomeName=<dark_red>Invalid home name\!
|
||||||
invalidItemFlagMeta=<dark_red>Invalid itemflag meta\: <secondary>{0}<dark_red>.
|
invalidItemFlagMeta=<dark_red>Invalid itemflag meta\: <secondary>{0}<dark_red>.
|
||||||
invalidMob=<dark_red>Invalid mob type.
|
invalidMob=<dark_red>Invalid mob type.
|
||||||
|
invalidModifier=<dark_red>Invalid Modifier.
|
||||||
invalidNumber=Invalid Number.
|
invalidNumber=Invalid Number.
|
||||||
invalidPotion=<dark_red>Invalid Potion.
|
invalidPotion=<dark_red>Invalid Potion.
|
||||||
invalidPotionMeta=<dark_red>Invalid potion meta\: <secondary>{0}<dark_red>.
|
invalidPotionMeta=<dark_red>Invalid potion meta\: <secondary>{0}<dark_red>.
|
||||||
|
Loading…
Reference in New Issue
Block a user