@@ -74,7 +74,6 @@ public class SparkPlatform {
7474 private final BytebinClient bytebinClient ;
7575 private final BytesocksClient bytesocksClient ;
7676 private final TrustedKeyStore trustedKeyStore ;
77- private final CommandManager commandManager ;
7877 private final ActivityLog activityLog ;
7978 private final SamplerContainer samplerContainer ;
8079 private final BackgroundSamplerManager backgroundSamplerManager ;
@@ -83,9 +82,10 @@ public class SparkPlatform {
8382 private final TickStatistics tickStatistics ;
8483 private final PingStatistics pingStatistics ;
8584 private final PlatformStatisticsProvider statisticsProvider ;
85+ private final CommandManager commandManager ;
86+ private final AtomicBoolean enabled = new AtomicBoolean (false );
8687 private Map <String , GarbageCollectorStatistics > startupGcStatistics = ImmutableMap .of ();
8788 private long serverNormalOperationStartTime ;
88- private final AtomicBoolean enabled = new AtomicBoolean (false );
8989
9090 public SparkPlatform (SparkPlugin plugin ) {
9191 this .plugin = plugin ;
@@ -112,8 +112,6 @@ public SparkPlatform(SparkPlugin plugin) {
112112 this .activityLog = new ActivityLog (plugin .getPluginDirectory ().resolve ("activity.json" ));
113113 this .activityLog .load ();
114114
115- this .commandManager = new CommandManager (this , this .configuration );
116-
117115 this .samplerContainer = new SamplerContainer ();
118116 this .backgroundSamplerManager = new BackgroundSamplerManager (this , this .configuration );
119117
@@ -129,6 +127,8 @@ public SparkPlatform(SparkPlugin plugin) {
129127 this .pingStatistics = pingProvider != null ? new PingStatistics (pingProvider ) : null ;
130128
131129 this .statisticsProvider = new PlatformStatisticsProvider (this );
130+
131+ this .commandManager = new CommandManager (this , this .configuration );
132132 }
133133
134134 public void enable () {
@@ -164,6 +164,8 @@ public void enable() {
164164 }
165165
166166 public void disable () {
167+ this .commandManager .close ();
168+
167169 if (this .tickHook != null ) {
168170 this .tickHook .close ();
169171 }
@@ -174,8 +176,6 @@ public void disable() {
174176 this .pingStatistics .close ();
175177 }
176178
177- this .commandManager .close ();
178-
179179 this .samplerContainer .close ();
180180
181181 SparkApi .unregister ();
@@ -279,15 +279,15 @@ public Path resolveSaveFile(String prefix, String extension) {
279279 }
280280
281281 public boolean hasPermissionForAnyCommand (CommandSender sender ) {
282- return commandManager .hasPermissionForAnyCommand (sender );
282+ return this . commandManager .hasPermissionForAnyCommand (sender );
283283 }
284284
285285 public CompletableFuture <Void > executeCommand (CommandSender sender , String [] args ) {
286- return commandManager .executeCommand (sender , args );
286+ return this . commandManager .executeCommand (sender , args );
287287 }
288288
289289 public List <String > tabCompleteCommand (CommandSender sender , String [] args ) {
290- return commandManager .tabCompleteCommand (sender , args );
290+ return this . commandManager .tabCompleteCommand (sender , args );
291291 }
292292
293293}
0 commit comments