+ Velocity 3.x support

This commit is contained in:
Alberto Migliorato
2021-09-13 17:40:57 +02:00
parent 3a64afa0ae
commit 118616b62b
2 changed files with 10 additions and 2 deletions
@@ -31,6 +31,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import com.velocitypowered.api.command.CommandMeta;
import net.kyori.adventure.text.format.TextColor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -133,7 +134,8 @@ public class VelocityCommandManager extends
if (force) {
proxy.getCommandManager().unregister(commandName);
}
proxy.getCommandManager().register(commandName, velocityCommand);
CommandMeta meta = proxy.getCommandManager().metaBuilder(commandName).build();
proxy.getCommandManager().register(meta, velocityCommand);
}
velocityCommand.isRegistered = true;
registeredCommands.put(commandName, velocityCommand);
@@ -30,8 +30,9 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.SetMultimap;
import com.velocitypowered.api.command.Command;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.command.SimpleCommand;
public class VelocityRootCommand implements Command, RootCommand {
public class VelocityRootCommand implements Command, RootCommand, SimpleCommand {
private final VelocityCommandManager manager;
private final String name;
@@ -86,4 +87,9 @@ public class VelocityRootCommand implements Command, RootCommand {
public BaseCommand getDefCommand() {
return defCommand;
}
@Override
public void execute(Invocation invocation) {
execute(invocation.source(), invocation.arguments());
}
}