Skip to content

Commit

Permalink
get plugin instance once
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Feb 6, 2024
1 parent e62d789 commit 4c897c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ public interface AnarchyExploitFixesCommand {
boolean shouldRegister();

static void registerCommands() {
AnarchyExploitFixes plugin = AnarchyExploitFixes.getInstance();
try {
PaperCommandManager<CommandSender> manager = new PaperCommandManager<>(
/* Owning plugin */ AnarchyExploitFixes.getInstance(),
/* Owning plugin */ plugin,
/* Coordinator function */ AsynchronousCommandExecutionCoordinator.<CommandSender>builder().build(),
/* Command Sender -> C */ Function.identity(),
/* C -> Command Sender */ Function.identity()
Expand Down Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ public interface AnarchyExploitFixesCommand {
boolean shouldRegister();

static void registerCommands() {
AnarchyExploitFixes plugin = AnarchyExploitFixes.getInstance();
try {
PaperCommandManager<CommandSender> manager = new PaperCommandManager<>(
/* Owning plugin */ AnarchyExploitFixes.getInstance(),
/* Owning plugin */ plugin,
/* Coordinator function */ AsynchronousCommandExecutionCoordinator.<CommandSender>builder().build(),
/* Command Sender -> C */ Function.identity(),
/* C -> Command Sender */ Function.identity()
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 4c897c3

Please sign in to comment.