From 243c5ea6ea408e33faa14081b58c63298a8e8381 Mon Sep 17 00:00:00 2001 From: garbagemule Date: Mon, 8 Dec 2014 16:45:05 +0100 Subject: [PATCH] Make numeric regexes require at least one number to match. --- src/com/garbagemule/MobArena/util/PotionEffectParser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/garbagemule/MobArena/util/PotionEffectParser.java b/src/com/garbagemule/MobArena/util/PotionEffectParser.java index 594fa6e..a86f96d 100644 --- a/src/com/garbagemule/MobArena/util/PotionEffectParser.java +++ b/src/com/garbagemule/MobArena/util/PotionEffectParser.java @@ -92,7 +92,7 @@ public class PotionEffectParser private static PotionEffectType getType(String type) { PotionEffectType effect = null; - if (type.matches("[0-9]*")) { + if (type.matches("[0-9]+")) { effect = PotionEffectType.getById(Integer.parseInt(type)); } else { effect = PotionEffectType.getByName(type.toUpperCase()); @@ -104,7 +104,7 @@ public class PotionEffectParser private static int getDuration(String duration) { int dur = -1; - if (duration.matches("[0-9]*")) { + if (duration.matches("[0-9]+")) { dur = Integer.parseInt(duration); } @@ -114,7 +114,7 @@ public class PotionEffectParser private static int getAmplification(String amplifier) { int amp = -1; - if (amplifier.matches("[0-9]*")) { + if (amplifier.matches("[0-9]+")) { amp = Integer.parseInt(amplifier); }