mirror of
https://github.com/kaboomserver/extras.git
synced 2025-02-11 03:29:50 +00:00
Improve distance selector detection
This commit is contained in:
parent
a91c25f8c2
commit
634661e1fa
1 changed files with 4 additions and 2 deletions
|
@ -19,6 +19,8 @@ import java.util.regex.Pattern;
|
|||
public final class ServerCommand implements Listener {
|
||||
private static final Pattern AS_AT_PATTERN = Pattern.compile(
|
||||
"\\b(as|at|facing entity) @[ae]\\b");
|
||||
private static final Pattern DISTANCE_SELECTOR_PATTERN = Pattern.compile(
|
||||
"[\"']?distance[\"']?\\s*=\\s*");
|
||||
private static final Logger LOGGER = JavaPlugin.getPlugin(Main.class).getLogger();
|
||||
|
||||
public static boolean checkExecuteCommand(final String cmd) {
|
||||
|
@ -208,8 +210,8 @@ public final class ServerCommand implements Listener {
|
|||
}
|
||||
|
||||
if (command.contains("distance")) {
|
||||
return command.replace("distance=", "]").replace("\"distance\"=", "]")
|
||||
.replace("'distance'=", "]");
|
||||
final Matcher distanceMatcher = DISTANCE_SELECTOR_PATTERN.matcher(command);
|
||||
return distanceMatcher.replaceAll("]");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue