mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 01:27:40 +01:00
Added a new mirroring option in the config of 'all_unnamed_worlds'. This
will cause all new or unnamed worlds to use this mirroring.
This commit is contained in:
parent
13e07f64ec
commit
90730f63d5
@ -214,4 +214,5 @@ v 2.0:
|
||||
- Added '/mancheckw <world>' to inspect which permission files a world is referencing.
|
||||
- Add config potion to set if GM commands should be allowed on CommnandBlocks.
|
||||
- Catch the error when using an out of date config for 'allow_commandblocks' So it doesn't kill the whole config.
|
||||
- '/manselect' will no longer list duplicate worlds.
|
||||
- '/manselect' will no longer list duplicate worlds.
|
||||
- Added a new mirroring option in the config of 'all_unnamed_worlds'. This will cause all new or unnamed worlds to use this mirroring.
|
@ -37,6 +37,9 @@ settings:
|
||||
world_the_end:
|
||||
- users
|
||||
- groups
|
||||
all_unnamed_worlds:
|
||||
- users
|
||||
- groups
|
||||
# world2: (World2 would have it's own set of user and groups files)
|
||||
# world3:
|
||||
# - users (World3 would use the users.yml from world2, but it's own groups.yml)
|
||||
|
@ -59,6 +59,23 @@ public class WorldsHolder {
|
||||
resetWorldsHolder();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the mirrorsGroup
|
||||
*/
|
||||
public Map<String, String> getMirrorsGroup() {
|
||||
|
||||
return mirrorsGroup;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the mirrorsUser
|
||||
*/
|
||||
public Map<String, String> getMirrorsUser() {
|
||||
|
||||
return mirrorsUser;
|
||||
}
|
||||
|
||||
public void resetWorldsHolder() {
|
||||
|
||||
worldsData = new HashMap<String, OverloadedWorldHolder>();
|
||||
@ -92,33 +109,46 @@ public class WorldsHolder {
|
||||
private void loadAllSearchedWorlds() {
|
||||
|
||||
/*
|
||||
* Read all known worlds from Bukkit
|
||||
* Create the data files if they don't already exist,
|
||||
* and they are not mirrored.
|
||||
* Read all known worlds from Bukkit Create the data files if they don't
|
||||
* already exist, and they are not mirrored.
|
||||
*/
|
||||
for (World world : plugin.getServer().getWorlds()){
|
||||
for (World world : plugin.getServer().getWorlds()) {
|
||||
GroupManager.logger.log(Level.FINE, "Checking data for " + world.getName() + ".");
|
||||
if ((!worldsData.containsKey(world.getName().toLowerCase())) && ((!mirrorsGroup.containsKey(world.getName().toLowerCase())) || (!mirrorsUser.containsKey(world.getName().toLowerCase())))) {
|
||||
|
||||
if (plugin.getWorldsHolder().getWorldData("all_unnamed_worlds") != null) {
|
||||
|
||||
String usersMirror = plugin.getWorldsHolder().getMirrorsUser().get("all_unnamed_worlds");
|
||||
String groupsMirror = plugin.getWorldsHolder().getMirrorsGroup().get("all_unnamed_worlds");
|
||||
|
||||
if (usersMirror != null)
|
||||
plugin.getWorldsHolder().getMirrorsUser().put(world.getName().toLowerCase(), usersMirror);
|
||||
|
||||
if (groupsMirror != null)
|
||||
plugin.getWorldsHolder().getMirrorsGroup().put(world.getName().toLowerCase(), groupsMirror);
|
||||
|
||||
}
|
||||
|
||||
GroupManager.logger.log(Level.FINE, "Creating folders for " + world.getName() + ".");
|
||||
setupWorldFolder(world.getName());
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Loop over all folders within the worlds folder
|
||||
* and attempt to load the world data
|
||||
* Loop over all folders within the worlds folder and attempt to load
|
||||
* the world data
|
||||
*/
|
||||
for (File folder : worldsFolder.listFiles()) {
|
||||
if (folder.isDirectory() && !folder.getName().startsWith(".")) {
|
||||
GroupManager.logger.info("World Found: " + folder.getName());
|
||||
|
||||
/*
|
||||
* don't load any worlds which are already loaded
|
||||
* or fully mirrored worlds that don't need data.
|
||||
* don't load any worlds which are already loaded or fully
|
||||
* mirrored worlds that don't need data.
|
||||
*/
|
||||
if (!worldsData.containsKey(folder.getName().toLowerCase()) && ((!mirrorsGroup.containsKey(folder.getName().toLowerCase())) || (!mirrorsUser.containsKey(folder.getName().toLowerCase())))) {
|
||||
/*
|
||||
* Call setupWorldFolder to check case sensitivity
|
||||
* and convert to lower case, before we attempt to load this
|
||||
* Call setupWorldFolder to check case sensitivity and
|
||||
* convert to lower case, before we attempt to load this
|
||||
* world.
|
||||
*/
|
||||
setupWorldFolder(folder.getName());
|
||||
|
@ -35,8 +35,24 @@ public class GMWorldListener implements Listener {
|
||||
if (GroupManager.isLoaded() && !plugin.getWorldsHolder().isInList(worldName)) {
|
||||
GroupManager.logger.info("New world detected...");
|
||||
GroupManager.logger.info("Creating data for: " + worldName);
|
||||
|
||||
if (plugin.getWorldsHolder().getWorldData("all_unnamed_worlds") != null) {
|
||||
|
||||
String usersMirror = plugin.getWorldsHolder().getMirrorsUser().get("all_unnamed_worlds");
|
||||
String groupsMirror = plugin.getWorldsHolder().getMirrorsGroup().get("all_unnamed_worlds");
|
||||
|
||||
if (usersMirror != null)
|
||||
plugin.getWorldsHolder().getMirrorsUser().put(worldName.toLowerCase(), usersMirror);
|
||||
|
||||
if (groupsMirror != null)
|
||||
plugin.getWorldsHolder().getMirrorsGroup().put(worldName.toLowerCase(), groupsMirror);
|
||||
|
||||
}
|
||||
|
||||
plugin.getWorldsHolder().setupWorldFolder(worldName);
|
||||
plugin.getWorldsHolder().loadWorld(worldName);
|
||||
|
||||
|
||||
if (plugin.getWorldsHolder().isInList(worldName)) {
|
||||
GroupManager.logger.info("Don't forget to configure/mirror this world in config.yml.");
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user