Fix save operation in server tick

This commit is contained in:
zontreck 2024-01-21 22:08:44 -07:00
parent 80e068c198
commit ad35b5d07c

View file

@ -120,7 +120,7 @@ public class EventHandler {
if(ALIVE_TICKS.getAndIncrement() % 10 == 0)
{
restoreBurnedBlocks();
if(restoreBurnedBlocks())
FireMod.blockRestoreData.commit();
}
}
@ -138,7 +138,7 @@ public class EventHandler {
}
public void restoreBurnedBlocks() {
public boolean restoreBurnedBlocks() {
long currentTime = Instant.now().getEpochSecond();
Lock lock = FireMod.blockRestoreData.acquireWriteLock();
@ -159,13 +159,15 @@ public class EventHandler {
//FireMod.LOGGER.info("Restoring burned block");
return;
return true;
}
}
}finally {
lock.unlock();
}
return false;
}
}