mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 19:47:44 +01:00
Use Pattern#quote instead of \\
This commit is contained in:
parent
107e1e3e19
commit
17ce859bdd
@ -14,7 +14,7 @@ import net.minestom.server.network.packet.server.play.TabCompletePacket;
|
||||
import net.minestom.server.utils.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class TabCompleteListener {
|
||||
|
||||
@ -24,13 +24,7 @@ public class TabCompleteListener {
|
||||
String commandString = packet.text.replaceFirst(CommandManager.COMMAND_PREFIX, "");
|
||||
String[] split = commandString.split(StringUtils.SPACE);
|
||||
String commandName = split[0];
|
||||
String args;
|
||||
|
||||
try {
|
||||
args = commandString.replaceFirst(commandName, "");
|
||||
} catch (PatternSyntaxException exception) {
|
||||
args = commandName.replaceFirst(String.format("\\%s", commandName), "");
|
||||
}
|
||||
String args = commandString.replaceFirst(Pattern.quote(commandName), "");
|
||||
|
||||
final CommandQueryResult commandQueryResult = CommandParser.findCommand(commandString);
|
||||
if (commandQueryResult == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user