mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-09-13 08:28:02 +02:00
Fix for loading of worlds not in the config
Fix for folder creation of unique worlds
This commit is contained in:
parent
30af6f36ce
commit
1f6daa7424
@ -53,6 +53,7 @@ public class WorldsHolder {
|
|||||||
*/
|
*/
|
||||||
public WorldsHolder(GroupManager plugin) {
|
public WorldsHolder(GroupManager plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
// Setup folders and check files exist for the primary world
|
||||||
verifyFirstRun();
|
verifyFirstRun();
|
||||||
initialLoad();
|
initialLoad();
|
||||||
if (defaultWorld == null) {
|
if (defaultWorld == null) {
|
||||||
@ -61,17 +62,26 @@ public class WorldsHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initialLoad() {
|
private void initialLoad() {
|
||||||
|
// load the initial world
|
||||||
initialWorldLoading();
|
initialWorldLoading();
|
||||||
|
// Configure and load any mirrors and additional worlds as defined in config.yml
|
||||||
mirrorSetUp();
|
mirrorSetUp();
|
||||||
|
// search the worlds folder for any manually created worlds (not listed in config.yml)
|
||||||
|
loadAllSearchedWorlds();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialWorldLoading() {
|
private void initialWorldLoading() {
|
||||||
//LOAD EVERY WORLD POSSIBLE
|
//LOAD EVERY WORLD POSSIBLE
|
||||||
loadWorld(serverDefaultWorldName);
|
loadWorld(serverDefaultWorldName);
|
||||||
defaultWorld = worldsData.get(serverDefaultWorldName);
|
defaultWorld = worldsData.get(serverDefaultWorldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadAllSearchedWorlds() {
|
||||||
for (File folder : worldsFolder.listFiles()) {
|
for (File folder : worldsFolder.listFiles()) {
|
||||||
if (folder.getName().equalsIgnoreCase(serverDefaultWorldName)) {
|
if (folder.isDirectory())
|
||||||
|
GroupManager.logger.info("World Found: " + folder.getName());
|
||||||
|
|
||||||
|
if (worldsData.containsKey(folder.getName().toLowerCase())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (folder.isDirectory()) {
|
if (folder.isDirectory()) {
|
||||||
@ -88,6 +98,10 @@ public class WorldsHolder {
|
|||||||
for (String source : mirrorsMap.keySet()) {
|
for (String source : mirrorsMap.keySet()) {
|
||||||
// Make sure all non mirrored worlds have a set of data files.
|
// Make sure all non mirrored worlds have a set of data files.
|
||||||
setupWorldFolder(source);
|
setupWorldFolder(source);
|
||||||
|
// Load the world data
|
||||||
|
if (!worldsData.containsKey(source.toLowerCase()))
|
||||||
|
loadWorld(source);
|
||||||
|
|
||||||
if (mirrorsMap.get(source) instanceof ArrayList) {
|
if (mirrorsMap.get(source) instanceof ArrayList) {
|
||||||
ArrayList mirrorList = (ArrayList) mirrorsMap.get(source);
|
ArrayList mirrorList = (ArrayList) mirrorsMap.get(source);
|
||||||
for (Object o : mirrorList) {
|
for (Object o : mirrorList) {
|
||||||
@ -267,7 +281,7 @@ public class WorldsHolder {
|
|||||||
worldsFolder.mkdirs();
|
worldsFolder.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
File defaultWorldFolder = new File(worldsFolder, serverDefaultWorldName);
|
File defaultWorldFolder = new File(worldsFolder, worldName);
|
||||||
if (!defaultWorldFolder.exists()) {
|
if (!defaultWorldFolder.exists()) {
|
||||||
defaultWorldFolder.mkdirs();
|
defaultWorldFolder.mkdirs();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user