mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-10 18:28:28 +01:00
Completely remove the old WorldManager from startup
This commit is contained in:
parent
fe26ccb1eb
commit
82f47af924
@ -11,8 +11,6 @@ import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.anchor.AnchorManager;
|
||||
import com.onarandombox.MultiverseCore.api.Destination;
|
||||
import com.onarandombox.MultiverseCore.api.MVCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
|
||||
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
|
||||
import com.onarandombox.MultiverseCore.commandtools.PluginLocales;
|
||||
@ -60,9 +58,7 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
@Inject
|
||||
private Provider<MVCoreConfig> configProvider;
|
||||
@Inject
|
||||
private Provider<MVWorldManager> worldManagerProvider;
|
||||
@Inject
|
||||
private Provider<WorldManager> newWorldManagerProvider;
|
||||
private Provider<WorldManager> worldManagerProvider;
|
||||
@Inject
|
||||
private Provider<AnchorManager> anchorManagerProvider;
|
||||
@Inject
|
||||
@ -116,39 +112,24 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
Logging.setShowingConfig(shouldShowConfig());
|
||||
|
||||
var worldManager = worldManagerProvider.get();
|
||||
// Initialize the worlds
|
||||
worldManagerProvider.get().initAllWorlds();
|
||||
|
||||
worldManager.loadWorldsConfig();
|
||||
// worldManager.getDefaultWorldGenerators();
|
||||
// worldManager.loadDefaultWorlds();
|
||||
// worldManager.loadWorlds(true);
|
||||
//
|
||||
// // Now set the firstspawnworld (after the worlds are loaded):
|
||||
// worldManager.setFirstSpawnWorld(config.getFirstSpawnLocation());
|
||||
// MVWorld firstSpawnWorld = worldManager.getFirstSpawnWorld();
|
||||
// if (firstSpawnWorld != null) {
|
||||
// config.setFirstSpawnLocation(firstSpawnWorld.getName());
|
||||
// }
|
||||
|
||||
var newWorldManager = newWorldManagerProvider.get();
|
||||
newWorldManager.initAllWorlds(); // TODO: Possibly move this to constructor of WorldManager
|
||||
|
||||
//Setup economy here so vault is loaded
|
||||
this.loadEconomist();
|
||||
// Setup economy here so vault is loaded
|
||||
loadEconomist();
|
||||
|
||||
// Init all the other stuff
|
||||
this.loadAnchors();
|
||||
this.registerEvents();
|
||||
this.setUpLocales();
|
||||
this.registerCommands();
|
||||
this.registerDestinations();
|
||||
this.setupMetrics();
|
||||
this.loadPlaceholderAPIIntegration();
|
||||
this.saveAllConfigs();
|
||||
this.logEnableMessage();
|
||||
loadAnchors();
|
||||
registerEvents();
|
||||
setUpLocales();
|
||||
registerCommands();
|
||||
registerDestinations();
|
||||
setupMetrics();
|
||||
loadPlaceholderAPIIntegration();
|
||||
saveAllConfigs();
|
||||
logEnableMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,7 +137,7 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
*/
|
||||
@Override
|
||||
public void onDisable() {
|
||||
this.saveAllConfigs();
|
||||
saveAllConfigs();
|
||||
shutdownDependencyInjection();
|
||||
Logging.shutdown();
|
||||
}
|
||||
@ -382,7 +363,6 @@ public class MultiverseCore extends JavaPlugin implements MVCore {
|
||||
&& anchorManagerProvider.get().saveAnchors();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the best service from this plugin that implements the given contract or has the given implementation.
|
||||
*
|
||||
|
@ -379,7 +379,7 @@ public class WorldManager {
|
||||
return worldsMap.containsKey(worldName);
|
||||
}
|
||||
|
||||
public void saveWorldsConfig() {
|
||||
worldsConfigManager.save();
|
||||
public boolean saveWorldsConfig() {
|
||||
return worldsConfigManager.save();
|
||||
}
|
||||
}
|
||||
|
@ -41,12 +41,14 @@ public class WorldsConfigManager {
|
||||
return worldsConfig != null;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
public boolean save() {
|
||||
try {
|
||||
worldsConfig.save(worldConfigFile);
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<String> getAllWorldsInConfig() {
|
||||
|
Loading…
Reference in New Issue
Block a user