From f2cf051b4e5db4a6456da99b34a60ff4fe5500e1 Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Thu, 12 Jun 2014 11:13:55 -0500 Subject: [PATCH] Run the save every minute, instead of every 10 seconds. Next up: making mysql async. --- src/main/java/com/graywolf336/jail/JailTimer.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/graywolf336/jail/JailTimer.java b/src/main/java/com/graywolf336/jail/JailTimer.java index b38e8a2..c22ee3d 100644 --- a/src/main/java/com/graywolf336/jail/JailTimer.java +++ b/src/main/java/com/graywolf336/jail/JailTimer.java @@ -42,6 +42,15 @@ public class JailTimer { timer.start(); } + + //Save all the jail information every minute, not every 10 seconds + pl.getServer().getScheduler().runTaskTimerAsynchronously(pl, new Runnable() { + public void run() { + for(Jail j : pl.getJailManager().getJails()) { + pl.getJailIO().saveJail(j); + } + } + }, 1200L, 1200L); } /** Returns the instance of this timer. */ @@ -103,9 +112,6 @@ public class JailTimer { } } } - - //Save all the prisoners and jails after we're done - pl.getJailIO().saveJail(j); } } }