From 1f134d4501921e3684470d8df13f2734ab11d958 Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Sun, 26 Mar 2023 13:52:36 -0400 Subject: [PATCH] Use Provider for MultiverseCorePlaceholders in MultiverseCore. --- .../com/onarandombox/MultiverseCore/MultiverseCore.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index 7f831dd8..7ceb9022 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -64,6 +64,8 @@ public class MultiverseCore extends JavaPlugin implements MVCore { private Provider destinationsProviderProvider; @Inject private Provider metricsConfiguratorProvider; + @Inject + private Provider placeholdersProvider; // Counter for the number of plugins that have registered with us private int pluginCount; @@ -252,10 +254,9 @@ public class MultiverseCore extends JavaPlugin implements MVCore { private void setupPlaceholderAPI() { if(getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) { - var placeholders = serviceLocator.getService(MultiverseCorePlaceholders.class); - if (placeholders != null) { - placeholders.register(); - } + Try.of(() -> placeholdersProvider.get()) + .onSuccess(MultiverseCorePlaceholders::register) + .onFailure(e -> Logging.severe("Failed to load PlaceholderAPI integration.", e)); } }