Make purge task run options configurable. Also adds ability to disable

the task entirely.
This commit is contained in:
gmcferrin 2013-01-10 19:58:25 -05:00
parent ce42da5806
commit 6d9ef91315
3 changed files with 14 additions and 2 deletions

View File

@ -35,6 +35,7 @@ public class Config extends ConfigLoader {
public int getSaveInterval() { return config.getInt("General.Save_Interval", 10); }
public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
public int getPurgeInterval() { return config.getInt("General.Purge_Interval", 0); }
/* mySQL */
public boolean getUseMySQL() { return config.getBoolean("MySQL.Enabled", false); }

View File

@ -197,8 +197,15 @@ public class mcMMO extends JavaPlugin {
scheduler.scheduleSyncRepeatingTask(this, new BleedTimer(), 0, 40);
//Chunklet unloader (Runs every 20 seconds by default)
scheduler.scheduleSyncRepeatingTask(this, new ChunkletUnloader(), 0, ChunkletUnloader.RUN_INTERVAL * 20);
//Old & Powerless User remover (Runs every 6 hours)
scheduler.scheduleSyncRepeatingTask(this, new UserPurgeTask(), 0, 21600 * 20);
//Old & Powerless User remover
int purgeInterval = Config.getInstance().getPurgeInterval();
if (purgeInterval == 0) {
scheduler.runTask(this, new UserPurgeTask());
}
else if (purgeInterval > 0) {
scheduler.scheduleSyncRepeatingTask(this, new UserPurgeTask(), 0, purgeInterval * 60L * 60L * 20L);
}
registerCommands();

View File

@ -17,6 +17,10 @@ General:
#Allow mcMMO to inform other plugins of damage being dealt
Event_Callback: true
Power_Level_Cap: 0
#Amount of time (in hours) to wait between database purging
#To only run at server start, set to 0
#To never run, set to -1
Purge_Interval: 0
#
# Settings for using a mySQL database