mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-27 13:07:16 +01:00
Make numeric regexes require at least one number to match.
This commit is contained in:
parent
55e0500bae
commit
243c5ea6ea
@ -92,7 +92,7 @@ public class PotionEffectParser
|
|||||||
private static PotionEffectType getType(String type) {
|
private static PotionEffectType getType(String type) {
|
||||||
PotionEffectType effect = null;
|
PotionEffectType effect = null;
|
||||||
|
|
||||||
if (type.matches("[0-9]*")) {
|
if (type.matches("[0-9]+")) {
|
||||||
effect = PotionEffectType.getById(Integer.parseInt(type));
|
effect = PotionEffectType.getById(Integer.parseInt(type));
|
||||||
} else {
|
} else {
|
||||||
effect = PotionEffectType.getByName(type.toUpperCase());
|
effect = PotionEffectType.getByName(type.toUpperCase());
|
||||||
@ -104,7 +104,7 @@ public class PotionEffectParser
|
|||||||
private static int getDuration(String duration) {
|
private static int getDuration(String duration) {
|
||||||
int dur = -1;
|
int dur = -1;
|
||||||
|
|
||||||
if (duration.matches("[0-9]*")) {
|
if (duration.matches("[0-9]+")) {
|
||||||
dur = Integer.parseInt(duration);
|
dur = Integer.parseInt(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ public class PotionEffectParser
|
|||||||
private static int getAmplification(String amplifier) {
|
private static int getAmplification(String amplifier) {
|
||||||
int amp = -1;
|
int amp = -1;
|
||||||
|
|
||||||
if (amplifier.matches("[0-9]*")) {
|
if (amplifier.matches("[0-9]+")) {
|
||||||
amp = Integer.parseInt(amplifier);
|
amp = Integer.parseInt(amplifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user