Prechádzať zdrojové kódy

Configure all the save timer

NuclearW 13 rokov pred
rodič
commit
e36cd8109d

+ 2 - 1
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);

+ 1 - 1
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

+ 12 - 12
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();
+        }
+    }
 }

+ 2 - 0
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