mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-24 09:01:54 +01:00
Cleanup
This commit is contained in:
parent
becd876dcd
commit
de5e8e3e67
@ -31,7 +31,7 @@ public class CommandDispatcher {
|
||||
// Register aliases
|
||||
final String[] aliases = command.getAliases();
|
||||
if (aliases != null) {
|
||||
for (String alias : command.getAliases()) {
|
||||
for (String alias : aliases) {
|
||||
this.commandMap.put(alias.toLowerCase(), command);
|
||||
}
|
||||
}
|
||||
@ -62,13 +62,14 @@ public class CommandDispatcher {
|
||||
final String[] parts = commandString.split(StringUtils.SPACE);
|
||||
final String commandName = parts[0];
|
||||
|
||||
final String[] args = commandString.replaceFirst(Pattern.quote(commandName), "").trim().split(StringUtils.SPACE);
|
||||
|
||||
final Command command = findCommand(commandName);
|
||||
// Check if the command exists
|
||||
if (command == null)
|
||||
return null;
|
||||
|
||||
// Removes the command's name + the space after
|
||||
final String[] args = commandString.replaceFirst(Pattern.quote(commandName), "").trim().split(StringUtils.SPACE);
|
||||
|
||||
// Find the used syntax, or check which argument is wrong
|
||||
return findCommandResult(command, args);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class ArgumentStringArray extends Argument<String[]> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String[] parse(@NotNull String input) throws ArgumentSyntaxException {
|
||||
public String[] parse(@NotNull String input) {
|
||||
return input.split(Pattern.quote(StringUtils.SPACE));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.minestom.server.command.builder.arguments;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.command.CommandManager;
|
||||
import net.minestom.server.command.builder.exception.ArgumentSyntaxException;
|
||||
import net.minestom.server.network.packet.server.play.DeclareCommandsPacket;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.minestom.server.command.builder.arguments.number;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.command.builder.exception.ArgumentSyntaxException;
|
||||
import net.minestom.server.network.packet.server.play.DeclareCommandsPacket;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.minestom.server.command.builder.arguments.number;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.command.builder.exception.ArgumentSyntaxException;
|
||||
import net.minestom.server.network.packet.server.play.DeclareCommandsPacket;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.minestom.server.command.builder.arguments.number;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.command.builder.exception.ArgumentSyntaxException;
|
||||
import net.minestom.server.network.packet.server.play.DeclareCommandsPacket;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.minestom.server.command.builder.arguments.number;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.command.builder.exception.ArgumentSyntaxException;
|
||||
import net.minestom.server.network.packet.server.play.DeclareCommandsPacket;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
Loading…
Reference in New Issue
Block a user