Commit 15dca5a0 authored by Luke H-W's avatar Luke H-W Committed by GitHub
Browse files

GiveCommand: fix edge case with unspaced multiple args (#539)


Co-authored-by: default avatarAnimeGitB <AnimeGitB@bigblueball.in>
parent e693612e
...@@ -20,7 +20,7 @@ import java.util.regex.Matcher; ...@@ -20,7 +20,7 @@ import java.util.regex.Matcher;
public final class GiveCommand implements CommandHandler { public final class GiveCommand implements CommandHandler {
Pattern lvlRegex = Pattern.compile("l(?:vl?)?(\\d+)"); // Java is a joke of a proglang that doesn't have raw string literals Pattern lvlRegex = Pattern.compile("l(?:vl?)?(\\d+)"); // Java is a joke of a proglang that doesn't have raw string literals
Pattern refineRegex = Pattern.compile("r(\\d+)"); Pattern refineRegex = Pattern.compile("r(\\d+)");
Pattern amountRegex = Pattern.compile("((?<=x)\\d+|\\d+(?=x))"); Pattern amountRegex = Pattern.compile("((?<=x)\\d+|\\d+(?=x)(?!x\\d))");
private int matchIntOrNeg(Pattern pattern, String arg) { private int matchIntOrNeg(Pattern pattern, String arg) {
Matcher match = pattern.matcher(arg); Matcher match = pattern.matcher(arg);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment