summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--EssentialsGroupManager/src/Changelog.txt3
-rw-r--r--EssentialsGroupManager/src/config.yml3
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java50
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java16
4 files changed, 61 insertions, 11 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index 044bd62d3..4e5225bc2 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -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. \ No newline at end of file
+ - '/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. \ No newline at end of file
diff --git a/EssentialsGroupManager/src/config.yml b/EssentialsGroupManager/src/config.yml
index 4f5d087bd..103571dde 100644
--- a/EssentialsGroupManager/src/config.yml
+++ b/EssentialsGroupManager/src/config.yml
@@ -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)
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
index 9accfaf95..0dc9a63e9 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
@@ -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());
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java
index f7a7109ab..f89a70c4a 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java
@@ -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