diff --git a/NookCore-Command/src/main/java/com/nookure/core/command/annotation/FallbackCommandName.java b/NookCore-Command/src/main/java/com/nookure/core/command/annotation/FallbackCommandName.java new file mode 100644 index 0000000..f2c71f2 --- /dev/null +++ b/NookCore-Command/src/main/java/com/nookure/core/command/annotation/FallbackCommandName.java @@ -0,0 +1,14 @@ +package com.nookure.core.command.annotation; + +import com.google.inject.BindingAnnotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@BindingAnnotation +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.PARAMETER}) +public @interface FallbackCommandName { +} diff --git a/NookCore-Command/src/main/java/com/nookure/core/command/paper/PaperCommandManager.java b/NookCore-Command/src/main/java/com/nookure/core/command/paper/PaperCommandManager.java index 38edd34..8c51cf6 100644 --- a/NookCore-Command/src/main/java/com/nookure/core/command/paper/PaperCommandManager.java +++ b/NookCore-Command/src/main/java/com/nookure/core/command/paper/PaperCommandManager.java @@ -6,6 +6,7 @@ import com.nookure.core.PlayerWrapperBase; import com.nookure.core.command.Command; import com.nookure.core.command.CommandManager; +import com.nookure.core.command.annotation.FallbackCommandName; import com.nookure.core.command.config.CommandConfig; import com.nookure.core.command.config.CommandPartial; import com.nookure.core.config.ConfigurationContainer; @@ -31,6 +32,9 @@ public class PaperCommandManager

extends CommandMan private Injector injector; @Inject private ConfigurationContainer commandConfig; + @Inject + @FallbackCommandName + private String fallbackCommandName; @Override public void registerCommand(@NotNull Command command) { @@ -70,7 +74,7 @@ public void registerCommand(@NotNull Command command) { if (commandPartial.usage() != null && !commandPartial.usage().isEmpty()) templateCommand.setUsage(commandPartial.usage()); - commandMap.register("nkstaff", templateCommand); + commandMap.register(fallbackCommandName == null ? "nookure" : fallbackCommandName, templateCommand); command.prepare(); }