mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 03:22:19 +01:00
Use String.split for simple splits
By: md_5 <git@md-5.net>
This commit is contained in:
parent
c3487bf220
commit
6f25985272
1 changed files with 2 additions and 4 deletions
|
@ -18,7 +18,6 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.util.StringUtil;
|
||||
|
||||
public class SimpleCommandMap implements CommandMap {
|
||||
private static final Pattern PATTERN_ON_SPACE = Pattern.compile(" ", Pattern.LITERAL);
|
||||
protected final Map<String, Command> knownCommands = new HashMap<String, Command>();
|
||||
private final Server server;
|
||||
|
||||
|
@ -122,7 +121,7 @@ public class SimpleCommandMap implements CommandMap {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean dispatch(CommandSender sender, String commandLine) throws CommandException {
|
||||
String[] args = PATTERN_ON_SPACE.split(commandLine);
|
||||
String[] args = commandLine.split(" ");
|
||||
|
||||
if (args.length == 0) {
|
||||
return false;
|
||||
|
@ -206,8 +205,7 @@ public class SimpleCommandMap implements CommandMap {
|
|||
return null;
|
||||
}
|
||||
|
||||
String argLine = cmdLine.substring(spaceIndex + 1, cmdLine.length());
|
||||
String[] args = PATTERN_ON_SPACE.split(argLine, -1);
|
||||
String[] args = cmdLine.substring(spaceIndex + 1, cmdLine.length()).split(" ", -1);
|
||||
|
||||
try {
|
||||
return target.tabComplete(sender, commandName, args, location);
|
||||
|
|
Loading…
Reference in a new issue