diff --git a/velocity/pom.xml b/velocity/pom.xml
index 65bb6e19..11a3c010 100644
--- a/velocity/pom.xml
+++ b/velocity/pom.xml
@@ -32,7 +32,7 @@
com.velocitypowered
velocity-api
- 1.0.0-SNAPSHOT
+ 3.1.0
provided
diff --git a/velocity/src/main/java/co/aikar/commands/ACFVelocityUtil.java b/velocity/src/main/java/co/aikar/commands/ACFVelocityUtil.java
index 118bf243..fa9d9ce8 100644
--- a/velocity/src/main/java/co/aikar/commands/ACFVelocityUtil.java
+++ b/velocity/src/main/java/co/aikar/commands/ACFVelocityUtil.java
@@ -1,5 +1,11 @@
package co.aikar.commands;
+import com.velocitypowered.api.command.CommandSource;
+import com.velocitypowered.api.proxy.Player;
+import com.velocitypowered.api.proxy.ProxyServer;
+import net.kyori.adventure.text.TextComponent;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -7,18 +13,11 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
-import com.velocitypowered.api.command.CommandSource;
-import com.velocitypowered.api.proxy.Player;
-import com.velocitypowered.api.proxy.ProxyServer;
-
-import net.kyori.text.TextComponent;
-import net.kyori.text.serializer.legacy.LegacyComponentSerializer;
-
public class ACFVelocityUtil {
@SuppressWarnings("deprecation")
public static TextComponent color(String message) {
- return LegacyComponentSerializer.legacy().deserialize(message);
+ return LegacyComponentSerializer.legacy('&').deserialize(message);
}
public static Player findPlayerSmart(ProxyServer server, CommandIssuer issuer, String search) {
diff --git a/velocity/src/main/java/co/aikar/commands/VelocityCommandCompletions.java b/velocity/src/main/java/co/aikar/commands/VelocityCommandCompletions.java
index 3ece1af6..55c5c368 100644
--- a/velocity/src/main/java/co/aikar/commands/VelocityCommandCompletions.java
+++ b/velocity/src/main/java/co/aikar/commands/VelocityCommandCompletions.java
@@ -23,27 +23,26 @@
package co.aikar.commands;
+import co.aikar.commands.apachecommonslang.ApacheCommonsLangUtil;
+import com.velocitypowered.api.command.CommandSource;
+import com.velocitypowered.api.proxy.Player;
+import com.velocitypowered.api.proxy.ProxyServer;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextDecoration;
+import net.kyori.adventure.text.format.TextFormat;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import com.velocitypowered.api.command.CommandSource;
-import com.velocitypowered.api.proxy.Player;
-import com.velocitypowered.api.proxy.ProxyServer;
-
-import co.aikar.commands.apachecommonslang.ApacheCommonsLangUtil;
-import net.kyori.text.format.TextColor;
-import net.kyori.text.format.TextDecoration;
-import net.kyori.text.format.TextFormat;
-
public class VelocityCommandCompletions extends CommandCompletions {
public VelocityCommandCompletions(ProxyServer server, CommandManager manager) {
super(manager);
registerAsyncCompletion("chatcolors", c -> {
- Stream colors = Stream.of(TextColor.values());
+ Stream colors = Stream.of(NamedTextColor.NAMES.values().toArray(new TextFormat[0]));
if (!c.hasConfig("colorsonly")) {
colors = Stream.concat(colors, Stream.of(TextDecoration.values()));
}
diff --git a/velocity/src/main/java/co/aikar/commands/VelocityCommandContexts.java b/velocity/src/main/java/co/aikar/commands/VelocityCommandContexts.java
index d62f197a..bc33823a 100644
--- a/velocity/src/main/java/co/aikar/commands/VelocityCommandContexts.java
+++ b/velocity/src/main/java/co/aikar/commands/VelocityCommandContexts.java
@@ -23,19 +23,18 @@
package co.aikar.commands;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
+import co.aikar.commands.velocity.contexts.OnlinePlayer;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
-
-import co.aikar.commands.velocity.contexts.OnlinePlayer;
-import net.kyori.text.format.TextColor;
-import net.kyori.text.format.TextDecoration;
-import net.kyori.text.format.TextFormat;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextDecoration;
+import net.kyori.adventure.text.format.TextFormat;
import org.jetbrains.annotations.Nullable;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
public class VelocityCommandContexts extends CommandContexts {
VelocityCommandContexts(ProxyServer server, CommandManager manager) {
@@ -56,7 +55,7 @@ public class VelocityCommandContexts extends CommandContexts {
String first = c.popFirstArg();
- Stream colors = Stream.of(TextColor.values());
+ Stream colors = Stream.of(NamedTextColor.NAMES.values().toArray(new TextFormat[0]));
if (!c.hasFlag("colorsonly")) {
colors = Stream.concat(colors, Stream.of(TextDecoration.values()));
}
@@ -67,7 +66,7 @@ public class VelocityCommandContexts extends CommandContexts finalFilter.equals(ACFUtil.simplifyString(color.toString())));
}
- TextColor match = ACFUtil.simpleMatch(TextColor.class, first);
+ NamedTextColor match = NamedTextColor.NAMES.value(ACFUtil.simplifyString(first));
if (match == null) {
String valid = colors.map(color -> "" + ACFUtil.simplifyString(color.toString()) + "")
.collect(Collectors.joining(", "));
diff --git a/velocity/src/main/java/co/aikar/commands/VelocityCommandIssuer.java b/velocity/src/main/java/co/aikar/commands/VelocityCommandIssuer.java
index 755cf35f..eb5da27d 100644
--- a/velocity/src/main/java/co/aikar/commands/VelocityCommandIssuer.java
+++ b/velocity/src/main/java/co/aikar/commands/VelocityCommandIssuer.java
@@ -23,14 +23,12 @@
package co.aikar.commands;
-import java.nio.charset.StandardCharsets;
-import java.util.Objects;
-import java.util.UUID;
-
-import org.jetbrains.annotations.NotNull;
-
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Objects;
+import java.util.UUID;
public class VelocityCommandIssuer implements CommandIssuer {
private final VelocityCommandManager manager;
diff --git a/velocity/src/main/java/co/aikar/commands/VelocityCommandManager.java b/velocity/src/main/java/co/aikar/commands/VelocityCommandManager.java
index 3971cd45..764081b0 100644
--- a/velocity/src/main/java/co/aikar/commands/VelocityCommandManager.java
+++ b/velocity/src/main/java/co/aikar/commands/VelocityCommandManager.java
@@ -23,6 +23,18 @@
package co.aikar.commands;
+import co.aikar.commands.apachecommonslang.ApacheCommonsExceptionUtil;
+import com.velocitypowered.api.command.CommandMeta;
+import com.velocitypowered.api.command.CommandSource;
+import com.velocitypowered.api.plugin.Plugin;
+import com.velocitypowered.api.plugin.PluginContainer;
+import com.velocitypowered.api.proxy.Player;
+import com.velocitypowered.api.proxy.ProxyServer;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextColor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Collections;
@@ -31,18 +43,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.velocitypowered.api.command.CommandSource;
-import com.velocitypowered.api.plugin.Plugin;
-import com.velocitypowered.api.plugin.PluginContainer;
-import com.velocitypowered.api.proxy.Player;
-import com.velocitypowered.api.proxy.ProxyServer;
-
-import co.aikar.commands.apachecommonslang.ApacheCommonsExceptionUtil;
-import net.kyori.text.format.TextColor;
-
public class VelocityCommandManager extends
CommandManager {
@@ -56,10 +56,10 @@ public class VelocityCommandManager extends
public VelocityCommandManager(ProxyServer proxy, Object plugin) {
this.proxy = proxy;
this.plugin = proxy.getPluginManager().getPlugin(plugin.getClass().getAnnotation(Plugin.class).id()).get();
- this.formatters.put(MessageType.ERROR, defaultFormatter = new VelocityMessageFormatter(TextColor.RED, TextColor.YELLOW, TextColor.RED));
- this.formatters.put(MessageType.SYNTAX, new VelocityMessageFormatter(TextColor.YELLOW, TextColor.GREEN, TextColor.WHITE));
- this.formatters.put(MessageType.INFO, new VelocityMessageFormatter(TextColor.BLUE, TextColor.DARK_GREEN, TextColor.GREEN));
- this.formatters.put(MessageType.HELP, new VelocityMessageFormatter(TextColor.AQUA, TextColor.GREEN, TextColor.YELLOW));
+ this.formatters.put(MessageType.ERROR, defaultFormatter = new VelocityMessageFormatter(NamedTextColor.RED, NamedTextColor.YELLOW, NamedTextColor.RED));
+ this.formatters.put(MessageType.SYNTAX, new VelocityMessageFormatter(NamedTextColor.YELLOW, NamedTextColor.GREEN, NamedTextColor.WHITE));
+ this.formatters.put(MessageType.INFO, new VelocityMessageFormatter(NamedTextColor.BLUE, NamedTextColor.DARK_GREEN, NamedTextColor.GREEN));
+ this.formatters.put(MessageType.HELP, new VelocityMessageFormatter(NamedTextColor.AQUA, NamedTextColor.GREEN, NamedTextColor.YELLOW));
getLocales();
@@ -129,7 +129,10 @@ public class VelocityCommandManager extends
if (force) {
proxy.getCommandManager().unregister(commandName);
}
- proxy.getCommandManager().register(velocityCommand, commandName);
+ CommandMeta meta = proxy.getCommandManager()
+ .metaBuilder(commandName)
+ .build();
+ proxy.getCommandManager().register(meta, velocityCommand);
}
velocityCommand.isRegistered = true;
registeredCommands.put(commandName, velocityCommand);
diff --git a/velocity/src/main/java/co/aikar/commands/VelocityMessageFormatter.java b/velocity/src/main/java/co/aikar/commands/VelocityMessageFormatter.java
index 28c8d0ef..04c60888 100644
--- a/velocity/src/main/java/co/aikar/commands/VelocityMessageFormatter.java
+++ b/velocity/src/main/java/co/aikar/commands/VelocityMessageFormatter.java
@@ -1,7 +1,7 @@
package co.aikar.commands;
-import net.kyori.text.format.TextColor;
-import net.kyori.text.serializer.legacy.LegacyComponentSerializer;
+import net.kyori.adventure.text.format.TextColor;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
public class VelocityMessageFormatter extends MessageFormatter {
@@ -12,6 +12,6 @@ public class VelocityMessageFormatter extends MessageFormatter {
@Override
@SuppressWarnings("deprecation")
String format(TextColor color, String message) {
- return LegacyComponentSerializer.legacy().serialize(LegacyComponentSerializer.legacy().deserialize(message).color(color));
+ return LegacyComponentSerializer.legacy('&').serialize(LegacyComponentSerializer.legacy('&').deserialize(message).color(color));
}
}
\ No newline at end of file
diff --git a/velocity/src/main/java/co/aikar/commands/VelocityRootCommand.java b/velocity/src/main/java/co/aikar/commands/VelocityRootCommand.java
index be17eab4..eba3bc8b 100644
--- a/velocity/src/main/java/co/aikar/commands/VelocityRootCommand.java
+++ b/velocity/src/main/java/co/aikar/commands/VelocityRootCommand.java
@@ -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 SimpleCommand, RootCommand {
private final VelocityCommandManager manager;
private final String name;
@@ -75,13 +76,13 @@ public class VelocityRootCommand implements Command, RootCommand {
}
@Override
- public void execute(CommandSource source, String[] args) {
- execute(manager.getCommandIssuer(source), getCommandName(), args);
+ public void execute(Invocation invocation) {
+ execute(manager.getCommandIssuer(invocation.source()), getCommandName(), invocation.arguments());
}
@Override
- public List suggest(CommandSource source, String[] args) {
- return getTabCompletions(manager.getCommandIssuer(source), getCommandName(), args);
+ public List suggest(Invocation invocation) {
+ return getTabCompletions(manager.getCommandIssuer(invocation.source()), getCommandName(), invocation.arguments());
}
@Override