Remove EagerlyLoaded from MVEconomist.

This commit is contained in:
Jeremy Wood 2023-03-26 13:59:15 -04:00
parent 6f86416310
commit 52a2ff78c8
No known key found for this signature in database
GPG Key ID: C5BAD04C77B91B4B
2 changed files with 10 additions and 4 deletions

View File

@ -24,6 +24,7 @@ import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.config.MVCoreConfigProvider;
import com.onarandombox.MultiverseCore.destination.DestinationsProvider;
import com.onarandombox.MultiverseCore.economy.MVEconomist;
import com.onarandombox.MultiverseCore.inject.InjectableListener;
import com.onarandombox.MultiverseCore.inject.PluginInjection;
import com.onarandombox.MultiverseCore.placeholders.MultiverseCorePlaceholders;
@ -66,6 +67,8 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
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
private int pluginCount;
@ -123,8 +126,7 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
}
//Setup economy here so vault is loaded
// TODO we may need to change MVEconomist to have an enable method or something
// this.economist = new MVEconomist(this);
this.loadEconomist();
// Init all the other stuff
this.loadAnchors();
@ -171,6 +173,11 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
return !getConfigProvider().getConfig().getSilentStart();
}
private void loadEconomist() {
Try.run(() -> economistProvider.get())
.onFailure(e -> Logging.severe("Failed to load economy integration", e));
}
private void loadAnchors() {
Try.of(() -> anchorManagerProvider.get())
.onSuccess(AnchorManager::loadAnchors)

View File

@ -1,6 +1,5 @@
package com.onarandombox.MultiverseCore.economy;
import com.onarandombox.MultiverseCore.inject.EagerlyLoaded;
import jakarta.inject.Inject;
import org.bukkit.Material;
import org.bukkit.World;
@ -13,7 +12,7 @@ import org.jvnet.hk2.annotations.Service;
* Multiverse's Friendly Economist. This is used to deal with external economies and also item costs for stuff in MV.
*/
@Service
public class MVEconomist implements EagerlyLoaded {
public class MVEconomist {
private final VaultHandler vaultHandler;