Fix save operation in server tick
This commit is contained in:
parent
80e068c198
commit
ad35b5d07c
1 changed files with 6 additions and 4 deletions
|
@ -120,8 +120,8 @@ public class EventHandler {
|
|||
if(ALIVE_TICKS.getAndIncrement() % 10 == 0)
|
||||
{
|
||||
|
||||
restoreBurnedBlocks();
|
||||
FireMod.blockRestoreData.commit();
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue