mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 10:36:06 +01:00
Remove direct getService usage for DestinationsProvider.
This commit is contained in:
parent
a8b44dff78
commit
a8ec599b35
@ -61,6 +61,8 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
private Provider<AnchorManager> anchorManagerProvider;
|
||||
@Inject
|
||||
private Provider<MVCommandManager> commandManagerProvider;
|
||||
@Inject
|
||||
private Provider<DestinationsProvider>destinationsProviderProvider;
|
||||
|
||||
// Counter for the number of plugins that have registered with us
|
||||
private int pluginCount;
|
||||
@ -210,8 +212,12 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
* Register all the destinations.
|
||||
*/
|
||||
private void registerDestinations() {
|
||||
var destinationsProvider = serviceLocator.getService(DestinationsProvider.class);
|
||||
serviceLocator.getAllServices(Destination.class).forEach(destinationsProvider::registerDestination);
|
||||
Try.of(() -> destinationsProviderProvider.get())
|
||||
.andThenTry(destinationsProvider -> {
|
||||
serviceLocator.getAllServices(Destination.class)
|
||||
.forEach(destinationsProvider::registerDestination);
|
||||
})
|
||||
.onFailure(throwable -> Logging.severe("Failed to register destinations", throwable));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user