Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix velocity command #23

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.command.RawCommand;
import com.velocitypowered.api.command.SimpleCommand;
import me.fixeddev.commandflow.CommandManager;
import me.fixeddev.commandflow.Namespace;
import me.fixeddev.commandflow.NamespaceImpl;
import me.fixeddev.commandflow.command.Command;
import me.fixeddev.commandflow.exception.ArgumentParseException;
import me.fixeddev.commandflow.exception.CommandException;
import me.fixeddev.commandflow.exception.CommandUsage;
import me.fixeddev.commandflow.exception.InvalidSubCommandException;
import me.fixeddev.commandflow.exception.NoMoreArgumentsException;
import me.fixeddev.commandflow.exception.NoPermissionsException;
import me.fixeddev.commandflow.translator.Translator;
import net.kyori.text.Component;

import java.util.Arrays;
import java.util.List;

public class VelocityCommandWrapper implements RawCommand {
Expand All @@ -41,7 +38,7 @@ public VelocityCommandWrapper(Command command, CommandManager commandManager,
@Override
public void execute(Invocation invocation) {
CommandSource commandSource = invocation.source();
String argumentLine = invocation.alias() + invocation.arguments();
String argumentLine = invocation.alias() + " " + invocation.arguments();

Namespace namespace = new NamespaceImpl();
namespace.setObject(CommandSource.class, VelocityCommandManager.SENDER_NAMESPACE, commandSource);
Expand Down Expand Up @@ -73,12 +70,11 @@ public String[] getAliases() {
@Override
public List<String> suggest(Invocation invocation) {
CommandSource commandSource = invocation.source();
String argumentLine = invocation.arguments();

Namespace namespace = new NamespaceImpl();
namespace.setObject(CommandSource.class, VelocityCommandManager.SENDER_NAMESPACE, commandSource);

return commandManager.getSuggestions(namespace, argumentLine);
return commandManager.getSuggestions(namespace, Arrays.asList(invocation.arguments()));
}

protected static void sendMessageToSender(CommandException exception, Namespace namespace) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<version.bukkit>0.5.2</version.bukkit>
<version.discord>0.5.0</version.discord>
<version.bungee>0.5.2</version.bungee>
<version.velocity>0.5.2</version.velocity>
<version.velocity>0.5.3</version.velocity>
<version.brigadier>0.5.2</version.brigadier>
</properties>

Expand Down