save regularly

This commit is contained in:
Leijurv 2018-08-23 13:42:45 -07:00
parent 14df84ef0e
commit cacd2096ec
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
1 changed files with 15 additions and 0 deletions

View File

@ -66,6 +66,21 @@ public final class CachedWorld implements IBlockTypeAccess {
// Insert an invalid region element // Insert an invalid region element
cachedRegions.put(0, null); cachedRegions.put(0, null);
new PackerThread().start(); new PackerThread().start();
new Thread() {
public void run() {
try {
while (true) {
// since a region only saves if it's been modified since its last save
// saving every 10 minutes means that once it's time to exit
// we'll only have a couple regions to save
save();
Thread.sleep(600000);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
} }
public final void queueForPacking(Chunk chunk) { public final void queueForPacking(Chunk chunk) {