From 25f9d789fd869bf6259e8aed29e43f1460d5ec21 Mon Sep 17 00:00:00 2001 From: DerEchtePilz Date: Sat, 2 Mar 2024 13:14:11 +0100 Subject: [PATCH 1/6] Add support for plugin namespaces on Velocity --- .../jorel/commandapi/CommandAPIConfig.java | 9 +++++++ .../commandapi/CommandAPIBukkitConfig.java | 4 --- .../jorel/commandapi/CommandAPICommand.java | 16 +++++++++++ .../commandapi/CommandAPIVelocityConfig.java | 27 +++++++++++++++++++ .../dev/jorel/commandapi/CommandTree.java | 16 +++++++++++ .../commandapi/InternalVelocityConfig.java | 11 ++++++++ docssrc/src/setup_shading.md | 2 +- 7 files changed, 80 insertions(+), 5 deletions(-) diff --git a/commandapi-core/src/main/java/dev/jorel/commandapi/CommandAPIConfig.java b/commandapi-core/src/main/java/dev/jorel/commandapi/CommandAPIConfig.java index f7c1fcdcc3..ae0941fcc1 100644 --- a/commandapi-core/src/main/java/dev/jorel/commandapi/CommandAPIConfig.java +++ b/commandapi-core/src/main/java/dev/jorel/commandapi/CommandAPIConfig.java @@ -166,4 +166,13 @@ public Impl setNamespace(String namespace) { return instance(); } + /** + * Sets whether the CommandAPI should use the plugin's name as the default namespace + *

+ * If called, any call to {@link CommandAPIConfig#setNamespace(String)} will be ignored + * + * @return this CommandAPIConfig + */ + public abstract Impl usePluginNamespace(); + } diff --git a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/CommandAPIBukkitConfig.java b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/CommandAPIBukkitConfig.java index 0c6cbf1ddb..40dab1eccb 100644 --- a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/CommandAPIBukkitConfig.java +++ b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/CommandAPIBukkitConfig.java @@ -54,10 +54,6 @@ public CommandAPIBukkitConfig useMojangMappings(boolean useMojangMappings) { } /** - * Sets whether the CommandAPI should use the plugin's name as the default namespace - *

- * If called, any call to {@link CommandAPIConfig#setNamespace(String)} will be ignored - * * @return this CommandAPIBukkitConfig */ public CommandAPIBukkitConfig usePluginNamespace() { diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java index 8deb11546c..a862f74d07 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java @@ -1,6 +1,7 @@ package dev.jorel.commandapi; import com.velocitypowered.api.command.CommandSource; +import com.velocitypowered.api.proxy.ProxyServer; import dev.jorel.commandapi.arguments.Argument; public class CommandAPICommand extends AbstractCommandAPICommand, CommandSource> implements VelocityExecutable { @@ -41,6 +42,21 @@ public void register(String namespace) { super.register(namespace); } + /** + * Registers the command with the given plugin object + * + * @param plugin The plugin instance used to determine this command's namespace + */ + public void register(Object plugin) { + ProxyServer server = CommandAPIVelocity.getConfiguration().getServer(); + if (server.getPluginManager().fromInstance(plugin).isEmpty()) { + CommandAPI.logInfo("Using the default namespace to register commands since the given Object is not a Velocity plugin!"); + super.register(); + return; + } + super.register(server.getPluginManager().fromInstance(plugin).get().getDescription().getId()); + } + @Override public CommandAPICommand instance() { return this; diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java index f8c8b7acdc..8f3c7499f8 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java @@ -7,6 +7,7 @@ */ public class CommandAPIVelocityConfig extends CommandAPIConfig { ProxyServer server; + Object plugin; /** * Creates a new CommandAPIVelocityConfig object. Variables in this @@ -15,10 +16,36 @@ public class CommandAPIVelocityConfig extends CommandAPIConfig, CommandSource> implements VelocityExecutable { @@ -27,6 +28,21 @@ public void register(String namespace) { super.register(namespace); } + /** + * Registers the command with the given plugin object + * + * @param plugin The plugin instance used to determine this command's namespace + */ + public void register(Object plugin) { + ProxyServer server = CommandAPIVelocity.getConfiguration().getServer(); + if (server.getPluginManager().fromInstance(plugin).isEmpty()) { + CommandAPI.logInfo("Using the default namespace to register commands since the given Object is not a Velocity plugin!"); + super.register(); + return; + } + super.register(server.getPluginManager().fromInstance(plugin).get().getDescription().getId()); + } + @Override public CommandTree instance() { return this; diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/InternalVelocityConfig.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/InternalVelocityConfig.java index 08e391106f..ca0dbd5897 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/InternalVelocityConfig.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/InternalVelocityConfig.java @@ -11,6 +11,9 @@ public class InternalVelocityConfig extends InternalConfig { // The server that the CommandAPI is running on private final ProxyServer server; + // The plugin that loads the CommandAPI + private final Object plugin; + /** * Creates an {@link InternalVelocityConfig} from a {@link CommandAPIVelocityConfig} * @@ -19,6 +22,7 @@ public class InternalVelocityConfig extends InternalConfig { public InternalVelocityConfig(CommandAPIVelocityConfig config) { super(config); this.server = config.server; + this.plugin = config.plugin; } /** @@ -27,4 +31,11 @@ public InternalVelocityConfig(CommandAPIVelocityConfig config) { public ProxyServer getServer() { return server; } + + /** + * @return The plugin that loads the CommandAPI + */ + public Object getPlugin() { + return plugin; + } } diff --git a/docssrc/src/setup_shading.md b/docssrc/src/setup_shading.md index 837e54cd48..a5974de43a 100644 --- a/docssrc/src/setup_shading.md +++ b/docssrc/src/setup_shading.md @@ -35,6 +35,7 @@ public class CommandAPIConfig { CommandAPIConfig missingExecutorImplementationMessage(String value); // Set message to display when executor implementation is missing CommandAPIConfig dispatcherFile(File file); // If not null, the CommandAPI will create a JSON file with Brigadier's command tree CommandAPIConfig setNamespace(String namespace); // The namespace to use when the CommandAPI registers a command + CommandAPIConfig usePluginNamespace(); // Whether the CommandAPI should use the name of the plugin passed into the CommandAPIConfig implementation as the default namespace for commands CommandAPIConfig initializeNBTAPI(Class nbtContainerClass, Function nbtContainerConstructor); // Initializes hooks with an NBT API. See NBT arguments documentation page for more info } @@ -51,7 +52,6 @@ public class CommandAPIBukkitConfig extends CommandAPIConfig { CommandAPIBukkitConfig(JavaPlugin plugin); CommandAPIBukkitConfig shouldHookPaperReload(boolean hooked); // Whether the CommandAPI should hook into the Paper-exclusive ServerResourcesReloadedEvent - CommandAPIBukkitConfig usePluginNamespace(); // Whether the CommandAPI should use the name of the plugin passed into the CommandAPIBukkitConfig as the default namespace for commands } ``` From 42761cab3496fe66d9aea4de7e8282c4c6535a7e Mon Sep 17 00:00:00 2001 From: DerEchtePilz Date: Mon, 11 Mar 2024 09:16:50 +0100 Subject: [PATCH 2/6] Don't throw exception if PluginContainer isn't present --- .../dev/jorel/commandapi/CommandAPIVelocityConfig.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java index 8f3c7499f8..f676c3408b 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java @@ -1,7 +1,10 @@ package dev.jorel.commandapi; +import com.velocitypowered.api.plugin.PluginContainer; import com.velocitypowered.api.proxy.ProxyServer; +import java.util.Optional; + /** * A class that contains information needed to configure the CommandAPI on Velocity-based servers. */ @@ -41,7 +44,12 @@ public CommandAPIVelocityConfig usePluginNamespace() { CommandAPI.logNormal("Cannot use plugin namespace because plugin was not set or null. The currently set namespace wasn't changed."); return instance(); } - super.setNamespace(server.getPluginManager().fromInstance(plugin).orElseThrow().getDescription().getId()); + Optional pluginContainerOptional = server.getPluginManager().fromInstance(plugin); + if (pluginContainerOptional.isEmpty()) { + CommandAPI.logInfo("Using the default namespace to register commands since the given Object is not a Velocity plugin!"); + return instance(); + } + super.setNamespace(pluginContainerOptional.get().getDescription().getId()); super.usePluginNamespace = true; return instance(); } From 75eda593d0794fa3569cffa4a99407573573ff3a Mon Sep 17 00:00:00 2001 From: DerEchtePilz Date: Wed, 13 Mar 2024 09:04:12 +0100 Subject: [PATCH 3/6] Update messages to state the Object's name --- .../src/main/java/dev/jorel/commandapi/CommandAPICommand.java | 2 +- .../java/dev/jorel/commandapi/CommandAPIVelocityConfig.java | 2 +- .../src/main/java/dev/jorel/commandapi/CommandTree.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java index a862f74d07..f5382f4a5f 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java @@ -50,7 +50,7 @@ public void register(String namespace) { public void register(Object plugin) { ProxyServer server = CommandAPIVelocity.getConfiguration().getServer(); if (server.getPluginManager().fromInstance(plugin).isEmpty()) { - CommandAPI.logInfo("Using the default namespace to register commands since the given Object is not a Velocity plugin!"); + CommandAPI.logInfo("Using the default namespace to register commands since " + plugin.getClass().getSimpleName() + " is not a Velocity plugin!"); super.register(); return; } diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java index f676c3408b..e1e8c8673f 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java @@ -46,7 +46,7 @@ public CommandAPIVelocityConfig usePluginNamespace() { } Optional pluginContainerOptional = server.getPluginManager().fromInstance(plugin); if (pluginContainerOptional.isEmpty()) { - CommandAPI.logInfo("Using the default namespace to register commands since the given Object is not a Velocity plugin!"); + CommandAPI.logInfo("Cannot use plugin namespace because " + plugin.getClass().getSimpleName() + " is not a Velocity plugin! The currently set namespace wasn't changed."); return instance(); } super.setNamespace(pluginContainerOptional.get().getDescription().getId()); diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java index a8bb8d603f..75b8c60007 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java @@ -36,7 +36,7 @@ public void register(String namespace) { public void register(Object plugin) { ProxyServer server = CommandAPIVelocity.getConfiguration().getServer(); if (server.getPluginManager().fromInstance(plugin).isEmpty()) { - CommandAPI.logInfo("Using the default namespace to register commands since the given Object is not a Velocity plugin!"); + CommandAPI.logInfo("Using the default namespace to register commands since " + plugin.getClass().getSimpleName() + " is not a Velocity plugin!"); super.register(); return; } From 915bf24f0dd42279f1b670a8260126d989b8fe36 Mon Sep 17 00:00:00 2001 From: DerEchtePilz Date: Thu, 14 Mar 2024 11:48:42 +0100 Subject: [PATCH 4/6] Throw NPE when plugin object is null --- .../src/main/java/dev/jorel/commandapi/CommandAPICommand.java | 3 +++ .../src/main/java/dev/jorel/commandapi/CommandTree.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java index f5382f4a5f..6c8467362e 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java @@ -48,6 +48,9 @@ public void register(String namespace) { * @param plugin The plugin instance used to determine this command's namespace */ public void register(Object plugin) { + if (plugin == null) { + throw new NullPointerException("Parameter 'plugin' was null while trying to register command /" + meta.commandName + "!"); + } ProxyServer server = CommandAPIVelocity.getConfiguration().getServer(); if (server.getPluginManager().fromInstance(plugin).isEmpty()) { CommandAPI.logInfo("Using the default namespace to register commands since " + plugin.getClass().getSimpleName() + " is not a Velocity plugin!"); diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java index 75b8c60007..50f5922e0a 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java @@ -34,6 +34,9 @@ public void register(String namespace) { * @param plugin The plugin instance used to determine this command's namespace */ public void register(Object plugin) { + if (plugin == null) { + throw new NullPointerException("Parameter 'plugin' was null while trying to register command /" + meta.commandName + "!"); + } ProxyServer server = CommandAPIVelocity.getConfiguration().getServer(); if (server.getPluginManager().fromInstance(plugin).isEmpty()) { CommandAPI.logInfo("Using the default namespace to register commands since " + plugin.getClass().getSimpleName() + " is not a Velocity plugin!"); From da6d13976c93af707021b42425079d61e4dee5f9 Mon Sep 17 00:00:00 2001 From: DerEchtePilz Date: Thu, 14 Mar 2024 13:10:39 +0100 Subject: [PATCH 5/6] Apply suggestion Introduce a common variable for the Optional in CommandTree and CommandAPICommand Co-authored-by: willkroboth <46540330+willkroboth@users.noreply.github.com> --- .../main/java/dev/jorel/commandapi/CommandAPICommand.java | 8 ++++++-- .../src/main/java/dev/jorel/commandapi/CommandTree.java | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java index 6c8467362e..75b8d61691 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPICommand.java @@ -1,9 +1,12 @@ package dev.jorel.commandapi; import com.velocitypowered.api.command.CommandSource; +import com.velocitypowered.api.plugin.PluginContainer; import com.velocitypowered.api.proxy.ProxyServer; import dev.jorel.commandapi.arguments.Argument; +import java.util.Optional; + public class CommandAPICommand extends AbstractCommandAPICommand, CommandSource> implements VelocityExecutable { /** * Creates a new command builder @@ -52,12 +55,13 @@ public void register(Object plugin) { throw new NullPointerException("Parameter 'plugin' was null while trying to register command /" + meta.commandName + "!"); } ProxyServer server = CommandAPIVelocity.getConfiguration().getServer(); - if (server.getPluginManager().fromInstance(plugin).isEmpty()) { + Optional pluginContainerOptional = server.getPluginManager().fromInstance(plugin); + if (pluginContainerOptional.isEmpty()) { CommandAPI.logInfo("Using the default namespace to register commands since " + plugin.getClass().getSimpleName() + " is not a Velocity plugin!"); super.register(); return; } - super.register(server.getPluginManager().fromInstance(plugin).get().getDescription().getId()); + super.register(pluginContainerOptional.get().getDescription().getId()); } @Override diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java index 50f5922e0a..4f82c7b2db 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandTree.java @@ -1,9 +1,12 @@ package dev.jorel.commandapi; import com.velocitypowered.api.command.CommandSource; +import com.velocitypowered.api.plugin.PluginContainer; import com.velocitypowered.api.proxy.ProxyServer; import dev.jorel.commandapi.arguments.Argument; +import java.util.Optional; + public class CommandTree extends AbstractCommandTree, CommandSource> implements VelocityExecutable { /** * Creates a main root node for a command tree with a given command name @@ -38,12 +41,13 @@ public void register(Object plugin) { throw new NullPointerException("Parameter 'plugin' was null while trying to register command /" + meta.commandName + "!"); } ProxyServer server = CommandAPIVelocity.getConfiguration().getServer(); - if (server.getPluginManager().fromInstance(plugin).isEmpty()) { + Optional pluginContainerOptional = server.getPluginManager().fromInstance(plugin); + if (pluginContainerOptional.isEmpty()) { CommandAPI.logInfo("Using the default namespace to register commands since " + plugin.getClass().getSimpleName() + " is not a Velocity plugin!"); super.register(); return; } - super.register(server.getPluginManager().fromInstance(plugin).get().getDescription().getId()); + super.register(pluginContainerOptional.get().getDescription().getId()); } @Override From e287520049cd354f63939473549dff7befb4adb9 Mon Sep 17 00:00:00 2001 From: DerEchtePilz Date: Thu, 14 Mar 2024 17:50:57 +0100 Subject: [PATCH 6/6] Remove the no longer needed constructor in CommandAPIVelocityConfig --- .../jorel/commandapi/examples/java/Examples.java | 2 +- .../jorel/commandapi/CommandAPIVelocityConfig.java | 14 -------------- .../java/dev/jorel/commandapi/CommandAPIMain.java | 2 +- .../src/main/java/io/github/jorelali/Main.java | 2 +- 4 files changed, 3 insertions(+), 17 deletions(-) diff --git a/commandapi-documentation-velocity-code/src/main/java/dev/jorel/commandapi/examples/java/Examples.java b/commandapi-documentation-velocity-code/src/main/java/dev/jorel/commandapi/examples/java/Examples.java index 9561dc138d..c31942b902 100644 --- a/commandapi-documentation-velocity-code/src/main/java/dev/jorel/commandapi/examples/java/Examples.java +++ b/commandapi-documentation-velocity-code/src/main/java/dev/jorel/commandapi/examples/java/Examples.java @@ -29,7 +29,7 @@ public ExamplePlugin(ProxyServer server, Logger logger) { this.server = server; this.logger = logger; - CommandAPI.onLoad(new CommandAPIVelocityConfig(server)); + CommandAPI.onLoad(new CommandAPIVelocityConfig(server, this)); } /* ANCHOR_END: velocityIntro1 */ diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java index e1e8c8673f..d41ff4209a 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/CommandAPIVelocityConfig.java @@ -12,16 +12,6 @@ public class CommandAPIVelocityConfig extends CommandAPIConfig pluginContainerOptional = server.getPluginManager().fromInstance(plugin); if (pluginContainerOptional.isEmpty()) { CommandAPI.logInfo("Cannot use plugin namespace because " + plugin.getClass().getSimpleName() + " is not a Velocity plugin! The currently set namespace wasn't changed."); diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-plugin/src/main/java/dev/jorel/commandapi/CommandAPIMain.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-plugin/src/main/java/dev/jorel/commandapi/CommandAPIMain.java index e0a3bd2f88..b6458cdb61 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-plugin/src/main/java/dev/jorel/commandapi/CommandAPIMain.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-plugin/src/main/java/dev/jorel/commandapi/CommandAPIMain.java @@ -58,7 +58,7 @@ public CommandAPIMain(ProxyServer server, Logger logger, @DataDirectory Path dat } // Configure the CommandAPI - CommandAPIVelocityConfig config = new CommandAPIVelocityConfig(server) + CommandAPIVelocityConfig config = new CommandAPIVelocityConfig(server, this) .verboseOutput(configYAML.getNode("verbose-outputs").getBoolean()) .silentLogs(configYAML.getNode("silent-logs").getBoolean()) .missingExecutorImplementationMessage(configYAML.getNode("messages", "missing-executor-implementation").getString()) diff --git a/examples/velocity/maven-shaded/src/main/java/io/github/jorelali/Main.java b/examples/velocity/maven-shaded/src/main/java/io/github/jorelali/Main.java index 6d4adc987f..dfe232ba0e 100644 --- a/examples/velocity/maven-shaded/src/main/java/io/github/jorelali/Main.java +++ b/examples/velocity/maven-shaded/src/main/java/io/github/jorelali/Main.java @@ -27,7 +27,7 @@ public Main(ProxyServer server, Logger logger, @DataDirectory Path dataFolder) { // Load the CommandAPI first CommandAPI.onLoad( // Configure the CommandAPI - new CommandAPIVelocityConfig(server) + new CommandAPIVelocityConfig(server, this) // Turn on verbose output for command registration logs .verboseOutput(true) // Give file where Brigadier's command registration tree should be dumped