summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org/anjocaido
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2013-02-22 12:39:41 +0000
committerElgarL <ElgarL@palmergames.com>2013-02-22 12:39:41 +0000
commit90730f63d5e1fbd5cef2cd9d856ea651d2a79bac (patch)
tree88bca9e38f9010d745aadd82263357987d376b31 /EssentialsGroupManager/src/org/anjocaido
parent13e07f64ecae02f002ac5a94ab7b39a2b4059718 (diff)
downloadEssentials-90730f63d5e1fbd5cef2cd9d856ea651d2a79bac.tar
Essentials-90730f63d5e1fbd5cef2cd9d856ea651d2a79bac.tar.gz
Essentials-90730f63d5e1fbd5cef2cd9d856ea651d2a79bac.tar.lz
Essentials-90730f63d5e1fbd5cef2cd9d856ea651d2a79bac.tar.xz
Essentials-90730f63d5e1fbd5cef2cd9d856ea651d2a79bac.zip
Added a new mirroring option in the config of 'all_unnamed_worlds'. This
will cause all new or unnamed worlds to use this mirroring.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java50
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java16
2 files changed, 56 insertions, 10 deletions
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