diff options
author | snowleo <schneeleo@gmail.com> | 2011-10-21 00:04:40 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-10-21 00:04:40 +0200 |
commit | 14c406f7fba6ee8e3d9f5ace056b6669feabb783 (patch) | |
tree | de3a10b3b0fe215aeee5f1f120e77effff2ebc8f | |
parent | 4d877741d4150bef4c81de622248244f86cceac4 (diff) | |
parent | 569af0bcf02a057f076aaea168109eb1a7b3faec (diff) | |
download | Essentials-14c406f7fba6ee8e3d9f5ace056b6669feabb783.tar Essentials-14c406f7fba6ee8e3d9f5ace056b6669feabb783.tar.gz Essentials-14c406f7fba6ee8e3d9f5ace056b6669feabb783.tar.lz Essentials-14c406f7fba6ee8e3d9f5ace056b6669feabb783.tar.xz Essentials-14c406f7fba6ee8e3d9f5ace056b6669feabb783.zip |
Merge branch 'refs/heads/groupmanager'
6 files changed, 32 insertions, 14 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 272a792e2..6729907b5 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -45,4 +45,7 @@ v 1.4: - Cleared remaining Cast errors cause by object cloning.
- Removed extra notification messages for the player issuing the group move command.
- Added a config setting - bukkit_perms_override: false
- Enable to allow default Bukkit based permissions to remain enabled, unless directly negated within GroupManager.
\ No newline at end of file + Enable to allow default Bukkit based permissions to remain enabled, unless directly negated within GroupManager.
+ - Fixed reading world mirrors from the config.
+ - Simplified config.yml while retaining backwards compatibility.
+ - Added data.save.hours setting to config. This allow control over how long backups are retained.
\ No newline at end of file diff --git a/EssentialsGroupManager/src/config.yml b/EssentialsGroupManager/src/config.yml index 0977362a5..25fb5dcd0 100644 --- a/EssentialsGroupManager/src/config.yml +++ b/EssentialsGroupManager/src/config.yml @@ -2,20 +2,24 @@ settings: config: # With this enabled anyone set as op has full permissions when managing GroupManager opOverrides: true + # If enabled any bukkit permissiosn which default to true will be left enabled. # If the player is op any permissions set to Op will follow suit. bukkit_perms_override: false + data: save: # How often GroupManager will save it's data back to groups and users.yml minutes: 10 + # Number of hours to retain backups (plugins/GroupManager/backup) + hours: 24 + logging: # level of detail GroupManager will use when logging. # Acceptable entries are - ALL,CONFIG,FINE,FINER,FINEST,INFO,OFF,SEVERE,WARNING level: INFO - permission: - world: - mirror: + + mirrors: # Worlds listed here have their permissions mirrored in their children. world: - world_nether diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java index af21b31bb..ad2945076 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java @@ -58,14 +58,22 @@ public class GMConfiguration { return GMconfig.getBoolean("settings.config.opOverrides", true); } - @SuppressWarnings("unchecked") - public Map<String, Object> getMirrorsMap() { - return (Map<String, Object>) GMconfig.getList("settings.permission.world.mirror"); + public Map<String, Object> getMirrorsMap() { + // Try to fetch the old mirror path first + if (GMconfig.isConfigurationSection("settings.permission.world.mirror")) + return (Map<String, Object>) GMconfig.getConfigurationSection("settings.permission.world.mirror").getValues(false); + else + return (Map<String, Object>) GMconfig.getConfigurationSection("settings.mirrors").getValues(false); + } public Integer getSaveInterval() { return GMconfig.getInt("settings.data.save.minutes", 10); } + + public Integer getBackupDuration() { + return GMconfig.getInt("settings.data.save.hours", 24); + } public void adjustLoggerLevel() { diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index 1f55f73ad..5ef4fc537 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -163,6 +163,7 @@ public class GroupManager extends JavaPlugin { int minutes = getGMConfig().getSaveInterval(); scheduler.scheduleAtFixedRate(commiter, minutes, minutes, TimeUnit.MINUTES); GroupManager.logger.info("Scheduled Data Saving is set for every " + minutes + " minutes!"); + GroupManager.logger.info("Backups will be retained for " + getGMConfig().getBackupDuration() + " hours!"); } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index 0bcf9a827..7cbe4f65c 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -99,11 +99,11 @@ public class WorldsHolder { * don't load any worlds which are already loaded * or mirrored worlds that don't need data. */ - if (worldsData.containsKey(folder.getName().toLowerCase()) - || mirrors.containsKey(folder.getName().toLowerCase())) { - continue; + if (!worldsData.containsKey(folder.getName().toLowerCase()) + || !mirrors.containsKey(folder.getName().toLowerCase())) { + loadWorld(folder.getName()); } - loadWorld(folder.getName()); + } } } @@ -168,7 +168,7 @@ public class WorldsHolder { if (alreadyDone.contains(w)) { continue; } - Tasks.removeOldFiles(plugin.getBackupFolder()); + Tasks.removeOldFiles(plugin, plugin.getBackupFolder()); if (w == null) { GroupManager.logger.severe("WHAT HAPPENED?"); continue; diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java index 8e4d58dde..f3defd94a 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java @@ -13,6 +13,8 @@ import java.io.OutputStream; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.List; + +import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.data.Group; /** @@ -43,9 +45,9 @@ public abstract class Tasks { copy(in, dst); } - public static void removeOldFiles(File folder) { + public static void removeOldFiles(GroupManager gm, File folder) { if (folder.isDirectory()) { - long oldTime = System.currentTimeMillis() - 86400000L; + long oldTime = System.currentTimeMillis() - (((long)gm.getGMConfig().getBackupDuration()*60*60)*1000); for (File olds : folder.listFiles()) { if (olds.isFile()) { if (olds.lastModified() < oldTime) { |