Prevent setting 'minutes' in the config to zero causing an error.

This commit is contained in:
ElgarL 2011-11-01 12:12:32 +00:00
parent 97cae6c0cb
commit 57f9bc06b0
2 changed files with 9 additions and 4 deletions

View File

@ -63,4 +63,5 @@ v 1.5:
- Fixed an error on 'manucheckv'. If the users doesn't have the variable it fell through causing an exception.
- Added checking of subgroups for Info nodes.
- Expanded 'canUserBuild()' to include inheritance and subgroups.
- Added a config.yml setting of 'validate_toggle' for those who prefer 'mantogglevalidate' to always be off.
- Added a config.yml setting of 'validate_toggle' for those who prefer 'mantogglevalidate' to always be off.
- Prevent setting 'minutes' in the config to zero causing an error.

View File

@ -88,10 +88,10 @@ public class GroupManager extends JavaPlugin {
public void onDisable() {
setLoaded(false);
disableScheduler(); // Shutdown before we save, so it doesn't interfere.
if (worldsHolder != null) {
worldsHolder.saveChanges();
}
disableScheduler();
WorldEvents = null;
BukkitPermissions = null;
@ -181,9 +181,13 @@ public class GroupManager extends JavaPlugin {
}
};
scheduler = new ScheduledThreadPoolExecutor(1);
int minutes = getGMConfig().getSaveInterval();
long minutes = (long)getGMConfig().getSaveInterval();
if (minutes > 0) {
scheduler.scheduleAtFixedRate(commiter, minutes, minutes, TimeUnit.MINUTES);
GroupManager.logger.info("Scheduled Data Saving is set for every " + minutes + " minutes!");
GroupManager.logger.info("Scheduled Data Saving is set for every " + minutes + " minutes!");
} else
GroupManager.logger.info("Scheduled Data Saving is Disabled!");
GroupManager.logger.info("Backups will be retained for " + getGMConfig().getBackupDuration() + " hours!");
}
}