diff --git a/src/main/java/co/crystaldev/alpinecore/AlpinePlugin.java b/src/main/java/co/crystaldev/alpinecore/AlpinePlugin.java index 9ef8e05..e3f6dcc 100644 --- a/src/main/java/co/crystaldev/alpinecore/AlpinePlugin.java +++ b/src/main/java/co/crystaldev/alpinecore/AlpinePlugin.java @@ -388,8 +388,8 @@ private void activateAll() { this.activate(classes, c -> AlpineConfig.class.isAssignableFrom(c) && !AlpinePluginConfig.class.isAssignableFrom(c)); this.activate(classes, AlpineIntegration.class::isAssignableFrom); this.activate(classes, AlpineEngine.class::isAssignableFrom); - this.activate(classes, AlpineCommand.class::isAssignableFrom); this.activate(classes, AlpineArgumentResolver.class::isAssignableFrom); + this.activate(classes, AlpineCommand.class::isAssignableFrom); this.activate(classes, c -> !AlpinePluginConfig.class.isAssignableFrom(c)); } @@ -447,7 +447,13 @@ private void setupCommandManager() { // Register all argument resolvers AlpineCore.getInstance().forEachResolver(resolver -> { - builder.argument(resolver.getType(), ArgumentKey.of(resolver.getKey()), resolver); + String key = resolver.getKey(); + if (key == null) { + builder.argument(resolver.getType(), resolver); + } + else { + builder.argument(resolver.getType(), ArgumentKey.of(key), resolver); + } }); // Let individual plugin commands mutate the command manager diff --git a/src/main/java/co/crystaldev/alpinecore/framework/command/AlpineArgumentResolver.java b/src/main/java/co/crystaldev/alpinecore/framework/command/AlpineArgumentResolver.java index 05ee795..fe4afc6 100644 --- a/src/main/java/co/crystaldev/alpinecore/framework/command/AlpineArgumentResolver.java +++ b/src/main/java/co/crystaldev/alpinecore/framework/command/AlpineArgumentResolver.java @@ -8,6 +8,7 @@ import lombok.Getter; import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * @author BestBearr @@ -18,7 +19,7 @@ public abstract class AlpineArgumentResolver extends ArgumentResolver type; - private final @NotNull String key; + private final @Nullable String key; @Override public final void activate(@NotNull AlpinePlugin context) {