Require count digit on quantity line if module is enabled
Also use the same pattern for validating the line in QuantityUtil and ChestShoSign.
This commit is contained in:
parent
419527efaa
commit
e40b5567b8
|
@ -6,7 +6,7 @@ import java.util.regex.Pattern;
|
||||||
* @author bricefrisco
|
* @author bricefrisco
|
||||||
*/
|
*/
|
||||||
public class QuantityUtil {
|
public class QuantityUtil {
|
||||||
private static final Pattern QUANTITY_LINE_WITH_COUNTER_PATTERN = Pattern.compile("^Q [1-9][0-9]{0,4} : C [0-9]{0,5}$");
|
public static final Pattern QUANTITY_LINE_WITH_COUNTER_PATTERN = Pattern.compile("^Q [1-9][0-9]{0,4} : C [0-9]{1,5}$");
|
||||||
|
|
||||||
public static int parseQuantity(String quantityLine) throws IllegalArgumentException {
|
public static int parseQuantity(String quantityLine) throws IllegalArgumentException {
|
||||||
if (quantityLineContainsCounter(quantityLine)) {
|
if (quantityLineContainsCounter(quantityLine)) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ChestShopSign {
|
||||||
public static final byte ITEM_LINE = 3;
|
public static final byte ITEM_LINE = 3;
|
||||||
|
|
||||||
public static final Pattern[][] SHOP_SIGN_PATTERN = {
|
public static final Pattern[][] SHOP_SIGN_PATTERN = {
|
||||||
{ Pattern.compile("^[1-9][0-9]{0,5}$"), Pattern.compile("^Q [1-9][0-9]{0,4} : C [0-9]{0,5}$") },
|
{ Pattern.compile("^[1-9][0-9]{0,5}$"), QuantityUtil.QUANTITY_LINE_WITH_COUNTER_PATTERN },
|
||||||
{
|
{
|
||||||
Pattern.compile("(?i)^((\\d*([.e]\\d+)?)|free)$"),
|
Pattern.compile("(?i)^((\\d*([.e]\\d+)?)|free)$"),
|
||||||
Pattern.compile("(?i)^([BS] *((\\d*([.e]\\d+)?)|free))( *: *([BS] *((\\d*([.e]\\d+)?)|free)))?$"),
|
Pattern.compile("(?i)^([BS] *((\\d*([.e]\\d+)?)|free))( *: *([BS] *((\\d*([.e]\\d+)?)|free)))?$"),
|
||||||
|
|
Loading…
Reference in New Issue