mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-06 00:08:04 +01:00
Remove EagerlyLoaded from AnchorManager.
This commit is contained in:
parent
472742dde8
commit
8b244e7d3b
@ -52,12 +52,13 @@ import org.jvnet.hk2.annotations.Service;
|
||||
public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
private static final int PROTOCOL = 50;
|
||||
|
||||
// Setup various managers
|
||||
private ServiceLocator serviceLocator;
|
||||
@Inject
|
||||
private MVCoreConfigProvider configProvider;
|
||||
@Inject
|
||||
private Provider<MVWorldManager> worldManagerProvider;
|
||||
@Inject
|
||||
private MVCoreConfigProvider configProvider;
|
||||
private Provider<AnchorManager> anchorManagerProvider;
|
||||
|
||||
// Counter for the number of plugins that have registered with us
|
||||
private int pluginCount;
|
||||
@ -119,8 +120,7 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
// this.economist = new MVEconomist(this);
|
||||
|
||||
// Init all the other stuff
|
||||
// TODO consider moving this into the AnchorManager constructor
|
||||
serviceLocator.getService(AnchorManager.class).loadAnchors();
|
||||
this.loadAnchors();
|
||||
this.registerEvents();
|
||||
this.registerCommands();
|
||||
this.setUpLocales();
|
||||
@ -164,6 +164,12 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
return !getConfigProvider().getConfig().getSilentStart();
|
||||
}
|
||||
|
||||
private void loadAnchors() {
|
||||
Try.of(() -> anchorManagerProvider.get())
|
||||
.onSuccess(AnchorManager::loadAnchors)
|
||||
.onFailure(throwable -> Logging.severe("Failed to load anchors", throwable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to Register all the Events needed.
|
||||
*/
|
||||
|
@ -11,7 +11,6 @@ import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.LocationManipulation;
|
||||
import com.onarandombox.MultiverseCore.config.MVCoreConfigProvider;
|
||||
import com.onarandombox.MultiverseCore.inject.EagerlyLoaded;
|
||||
import jakarta.inject.Inject;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -33,7 +32,7 @@ import java.util.Set;
|
||||
* Manages anchors.
|
||||
*/
|
||||
@Service
|
||||
public class AnchorManager implements EagerlyLoaded {
|
||||
public class AnchorManager {
|
||||
private Map<String, Location> anchors;
|
||||
private FileConfiguration anchorConfig;
|
||||
|
||||
|
@ -18,7 +18,6 @@ import com.onarandombox.MultiverseCore.listeners.MVPortalListener
|
||||
import com.onarandombox.MultiverseCore.listeners.MVWeatherListener
|
||||
import com.onarandombox.MultiverseCore.listeners.MVWorldInitListener
|
||||
import com.onarandombox.MultiverseCore.listeners.MVWorldListener
|
||||
import com.onarandombox.MultiverseCore.placeholders.MultiverseCorePlaceholders
|
||||
import com.onarandombox.MultiverseCore.teleportation.SimpleBlockSafety
|
||||
import com.onarandombox.MultiverseCore.teleportation.SimpleLocationManipulation
|
||||
import com.onarandombox.MultiverseCore.teleportation.SimpleSafeTTeleporter
|
||||
|
Loading…
Reference in New Issue
Block a user