From ade810ca8cf78a782686397c6d45e69b5b409486 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Sun, 7 Oct 2018 16:17:06 +0300 Subject: [PATCH] [Fix] Fix Command registration Issue was caused by no call to registerCommands was made at runtime. --- Plan/src/main/java/com/djrapitops/plan/Plan.java | 5 +++-- Plan/src/main/java/com/djrapitops/plan/PlanBungee.java | 5 +++-- Plan/src/main/java/com/djrapitops/plan/PlanSponge.java | 5 +++-- .../java/com/djrapitops/plan/command/PlanBungeeCommand.java | 2 ++ .../main/java/com/djrapitops/plan/command/PlanCommand.java | 2 ++ 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/Plan.java b/Plan/src/main/java/com/djrapitops/plan/Plan.java index 62242ec97..25f097ec2 100644 --- a/Plan/src/main/java/com/djrapitops/plan/Plan.java +++ b/Plan/src/main/java/com/djrapitops/plan/Plan.java @@ -88,7 +88,6 @@ class BukkitPlanModule { @Singleton @Named("mainCommand") CommandNode provideMainCommand(PlanCommand command) { - command.registerCommands(); return command; } } @@ -132,7 +131,9 @@ public class Plan extends BukkitPlugin implements PlanPlugin { logger.error("This error should be reported at https://github.com/Rsl1122/Plan-PlayerAnalytics/issues"); onDisable(); } - registerCommand("plan", component.planCommand()); + PlanCommand command = component.planCommand(); + command.registerCommands(); + registerCommand("plan", command); } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java b/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java index 1ae92fe6c..e6fea92b9 100644 --- a/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java +++ b/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java @@ -69,7 +69,6 @@ class BungeePlanModule { @Singleton @Named("mainCommand") CommandNode provideMainCommand(PlanBungeeCommand command) { - command.registerCommands(); return command; } } @@ -113,7 +112,9 @@ public class PlanBungee extends BungeePlugin implements PlanPlugin { logger.error("This error should be reported at https://github.com/Rsl1122/Plan-PlayerAnalytics/issues"); onDisable(); } - registerCommand("planbungee", component.planCommand()); + PlanBungeeCommand command = component.planCommand(); + command.registerCommands(); + registerCommand("planbungee", command); } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java b/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java index 3cff934ff..bcf2623d9 100644 --- a/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java +++ b/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java @@ -76,7 +76,6 @@ class SpongePlanModule { @Singleton @Named("mainCommand") CommandNode provideMainCommand(PlanCommand command) { - command.registerCommands(); return command; } } @@ -134,7 +133,9 @@ public class PlanSponge extends SpongePlugin implements PlanPlugin { slf4jLogger.error("This error should be reported at https://github.com/Rsl1122/Plan-PlayerAnalytics/issues"); onDisable(); } - registerCommand("plan", component.planCommand()); + PlanCommand command = component.planCommand(); + command.registerCommands(); + registerCommand("plan", command); } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java index 56c3f23e4..301eb2001 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java @@ -13,6 +13,7 @@ import com.djrapitops.plugin.command.TreeCmdNode; import dagger.Lazy; import javax.inject.Inject; +import javax.inject.Singleton; /** * TreeCommand for the /plan command, and all subcommands. @@ -22,6 +23,7 @@ import javax.inject.Inject; * @author Rsl1122 * @since 1.0.0 */ +@Singleton public class PlanBungeeCommand extends TreeCmdNode { private final NetworkCommand networkCommand; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java index 29ce7fb3e..8854676ee 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java @@ -12,6 +12,7 @@ import com.djrapitops.plugin.command.TreeCmdNode; import dagger.Lazy; import javax.inject.Inject; +import javax.inject.Singleton; /** * TreeCommand for the /plan command, and all SubCommands. @@ -21,6 +22,7 @@ import javax.inject.Inject; * @author Rsl1122 * @since 1.0.0 */ +@Singleton public class PlanCommand extends TreeCmdNode { private final PlanConfig config;