.
This commit is contained in:
parent
682cff9a8b
commit
a2d1153ae8
17 changed files with 439 additions and 326 deletions
|
|
@ -1,7 +1,7 @@
|
|||
package de.kentoj.kencommandapi;
|
||||
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.command.SimpleCommand;
|
||||
import com.velocitypowered.api.command.RawCommand;
|
||||
import de.kentoj.kencommandapi.api.CommandHandler;
|
||||
import de.kentoj.kencommandapi.api.literal.RootLiteral;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -9,14 +9,15 @@ import lombok.RequiredArgsConstructor;
|
|||
import java.util.List;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class VelocityCommand implements SimpleCommand {
|
||||
public class VelocityCommand implements RawCommand {
|
||||
|
||||
private final CommandHandler<CommandSource> commandHandler;
|
||||
private final RootLiteral<CommandSource> rootNode;
|
||||
|
||||
@Override
|
||||
public void execute(Invocation invocation) {
|
||||
commandHandler.invoke(rootNode, invocation.source(), invocation.arguments());
|
||||
var args = invocation.arguments().split(" ");
|
||||
commandHandler.invoke(rootNode, invocation.source(), args);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -27,6 +28,7 @@ public class VelocityCommand implements SimpleCommand {
|
|||
|
||||
@Override
|
||||
public List<String> suggest(Invocation invocation) {
|
||||
return commandHandler.getSuggestions(rootNode, invocation.source(), invocation.arguments());
|
||||
var args = invocation.arguments().split(" ");
|
||||
return commandHandler.getSuggestions(rootNode, invocation.source(), args, invocation.arguments().endsWith(" "));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue