diff options
Diffstat (limited to 'EssentialsGroupManager/src/org')
4 files changed, 10 insertions, 3 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java index 302f12b67..ad2945076 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java @@ -70,6 +70,10 @@ public class GMConfiguration { 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 573fcebc3..7cbe4f65c 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -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) { |