diff --git a/src/main/java/dev/zontreck/fire/events/EventHandler.java b/src/main/java/dev/zontreck/fire/events/EventHandler.java index c518df5..fe95700 100644 --- a/src/main/java/dev/zontreck/fire/events/EventHandler.java +++ b/src/main/java/dev/zontreck/fire/events/EventHandler.java @@ -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; + } }