mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 10:36:06 +01:00
Fix PAPI registration.
This commit is contained in:
parent
44dacdceb1
commit
edea4aff4b
@ -66,8 +66,6 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
@Inject
|
||||
private Provider<MetricsConfigurator> metricsConfiguratorProvider;
|
||||
@Inject
|
||||
private Provider<MultiverseCorePlaceholders> placeholdersProvider;
|
||||
@Inject
|
||||
private Provider<MVEconomist> economistProvider;
|
||||
|
||||
// Counter for the number of plugins that have registered with us
|
||||
@ -135,7 +133,7 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
this.setUpLocales();
|
||||
this.registerDestinations();
|
||||
this.setupMetrics();
|
||||
this.setupPlaceholderAPI();
|
||||
this.loadPlaceholderAPIIntegration();
|
||||
this.saveMVConfig();
|
||||
this.logEnableMessage();
|
||||
}
|
||||
@ -259,10 +257,9 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
}
|
||||
}
|
||||
|
||||
private void setupPlaceholderAPI() {
|
||||
private void loadPlaceholderAPIIntegration() {
|
||||
if(getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
Try.of(() -> placeholdersProvider.get())
|
||||
.onSuccess(MultiverseCorePlaceholders::register)
|
||||
Try.run(() -> serviceLocator.createAndInitialize(MultiverseCorePlaceholders.class))
|
||||
.onFailure(e -> Logging.severe("Failed to load PlaceholderAPI integration.", e));
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.economy.MVEconomist;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.inject.Inject;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -28,6 +29,12 @@ public class MultiverseCorePlaceholders extends PlaceholderExpansion {
|
||||
this.economist = economist;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
@Override
|
||||
public boolean register() {
|
||||
return super.register();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getIdentifier() {
|
||||
return "multiverse-core";
|
||||
|
Loading…
Reference in New Issue
Block a user