use of revxrsal.commands.velocity.VelocityCommandActor in project Lamp by Revxrsal.
the class VelocitySimpleCommand method execute.
@Override
public void execute(Invocation invocation) {
CommandSource source = invocation.source();
VelocityCommandActor actor = new VelocityActor(source, handler.getServer(), handler);
try {
ArgumentStack arguments = ArgumentStack.of(invocation.arguments());
arguments.addFirst(invocation.alias());
handler.dispatch(actor, arguments);
} catch (Throwable t) {
handler.getExceptionHandler().handleException(t, actor);
}
}
use of revxrsal.commands.velocity.VelocityCommandActor in project Lamp by Revxrsal.
the class VelocitySimpleCommand method suggest.
@Override
public List<String> suggest(Invocation invocation) {
try {
VelocityCommandActor actor = new VelocityActor(invocation.source(), handler.getServer(), handler);
ArgumentStack arguments;
if (invocation.arguments().length == 0)
arguments = ArgumentStack.forAutoCompletion("");
else
arguments = ArgumentStack.forAutoCompletion(invocation.arguments());
arguments.addFirst(invocation.alias());
return handler.getAutoCompleter().complete(actor, arguments);
} catch (ArgumentParseException e) {
return Collections.emptyList();
}
}
Aggregations