From e36cd8109d5130ccaa8d6f74880e8f72cd746da6 Mon Sep 17 00:00:00 2001 From: NuclearW Date: Thu, 9 Feb 2012 11:26:57 -0500 Subject: [PATCH] Configure all the save timer --- .../gmail/nossr50/config/LoadProperties.java | 3 ++- src/main/java/com/gmail/nossr50/mcMMO.java | 2 +- .../gmail/nossr50/runnables/mcSaveTimer.java | 24 +++++++++---------- src/main/resources/config.yml | 2 ++ 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index 82551e6ac..955aa60eb 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -71,7 +71,7 @@ public class LoadProperties { levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation, levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair, levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting, - anvilID; + anvilID, saveInterval; public static double xpbackground_r, xpbackground_g, xpbackground_b, xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g, @@ -297,6 +297,7 @@ public class LoadProperties { enableMotd = readBoolean("General.MOTD.Enabled", true); enableMySpawn = readBoolean("General.MySpawn.Enabled", true); enableRegen = readBoolean("General.HP_Regeneration.Enabled", true); + saveInterval = readInteger("General.Save_Interval", 10); enableCobbleToMossy = readBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); enableSmoothToMossy = readBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true); diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index e14ce1d60..c8314f64e 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -159,7 +159,7 @@ public class mcMMO extends JavaPlugin System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" ); //Periodic save timer (Saves every 10 minutes) - Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_SaveTimer, 0, 12000); + Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_SaveTimer, 0, LoadProperties.saveInterval * 1200); Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_Timer, 0, 20); //R2+ block place fix diff --git a/src/main/java/com/gmail/nossr50/runnables/mcSaveTimer.java b/src/main/java/com/gmail/nossr50/runnables/mcSaveTimer.java index 1ab5e4ddf..6d3f3d76c 100644 --- a/src/main/java/com/gmail/nossr50/runnables/mcSaveTimer.java +++ b/src/main/java/com/gmail/nossr50/runnables/mcSaveTimer.java @@ -1,5 +1,5 @@ /* - This file is part of mcMMO. + This file is part of mcMMO. mcMMO is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,18 +23,18 @@ import com.gmail.nossr50.mcMMO; public class mcSaveTimer implements Runnable { private final mcMMO plugin; - - public mcSaveTimer(final mcMMO plugin) + + public mcSaveTimer(final mcMMO plugin) { this.plugin = plugin; } - - public void run() - { - //All player data will be saved periodically through this - for(Player player : plugin.getServer().getOnlinePlayers()) - { - Users.getProfile(player).save(); - } - } + + public void run() + { + //All player data will be saved periodically through this + for(Player player : plugin.getServer().getOnlinePlayers()) + { + Users.getProfile(player).save(); + } + } } \ No newline at end of file diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 0cc8755a5..0bd57313b 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -257,6 +257,8 @@ General: Enabled: true MOTD: Enabled: true + #Amount of time (in minutes) to wait between saves of player information + Save_Interval: 10 Excavation: Drops: Cake: true