From 4c897c3f57dca004322b3b4253bc073b677fcf25 Mon Sep 17 00:00:00 2001 From: xGinko Date: Tue, 6 Feb 2024 14:07:06 +0100 Subject: [PATCH] get plugin instance once --- .../commands/AnarchyExploitFixesCommand.java | 6 +++--- .../commands/AnarchyExploitFixesCommand.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/commands/AnarchyExploitFixesCommand.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/commands/AnarchyExploitFixesCommand.java index 34b18982e..eb7eff6e0 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/commands/AnarchyExploitFixesCommand.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/commands/AnarchyExploitFixesCommand.java @@ -18,9 +18,10 @@ public interface AnarchyExploitFixesCommand { boolean shouldRegister(); static void registerCommands() { + AnarchyExploitFixes plugin = AnarchyExploitFixes.getInstance(); try { PaperCommandManager manager = new PaperCommandManager<>( - /* Owning plugin */ AnarchyExploitFixes.getInstance(), + /* Owning plugin */ plugin, /* Coordinator function */ AsynchronousCommandExecutionCoordinator.builder().build(), /* Command Sender -> C */ Function.identity(), /* C -> Command Sender */ Function.identity() @@ -60,8 +61,7 @@ static void registerCommands() { } } } catch (Throwable t) { - AnarchyExploitFixes.getLog().severe("Error registering commands! - " + t.getLocalizedMessage()); - AnarchyExploitFixes plugin = AnarchyExploitFixes.getInstance(); + plugin.getLogger().severe("Error registering commands! - " + t.getLocalizedMessage()); plugin.getServer().getPluginManager().disablePlugin(plugin); } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/commands/AnarchyExploitFixesCommand.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/commands/AnarchyExploitFixesCommand.java index edca1e8f7..075075ba3 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/commands/AnarchyExploitFixesCommand.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/commands/AnarchyExploitFixesCommand.java @@ -17,9 +17,10 @@ public interface AnarchyExploitFixesCommand { boolean shouldRegister(); static void registerCommands() { + AnarchyExploitFixes plugin = AnarchyExploitFixes.getInstance(); try { PaperCommandManager manager = new PaperCommandManager<>( - /* Owning plugin */ AnarchyExploitFixes.getInstance(), + /* Owning plugin */ plugin, /* Coordinator function */ AsynchronousCommandExecutionCoordinator.builder().build(), /* Command Sender -> C */ Function.identity(), /* C -> Command Sender */ Function.identity() @@ -58,8 +59,7 @@ static void registerCommands() { } } } catch (Throwable t) { - AnarchyExploitFixes.getLog().severe("Error registering commands! - " + t.getLocalizedMessage()); - AnarchyExploitFixes plugin = AnarchyExploitFixes.getInstance(); + plugin.getLogger().severe("Error registering commands! - " + t.getLocalizedMessage()); plugin.getServer().getPluginManager().disablePlugin(plugin); } }