File tree Expand file tree Collapse file tree
pylon-core/src/main/kotlin/io/github/pylonmc/pylon/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -342,15 +342,13 @@ object BlockStorage : Listener {
342342 // Wait a random delay before starting, this is to help smooth out lag from saving
343343 delay(Random .nextLong(PylonConfig .entityDataAutosaveIntervalSeconds * 1000 ))
344344
345- chunkAutosaveTasks[event.chunk.position] = PylonCore .launch(PylonCore .minecraftDispatcher) {
346- while (true ) {
347- lockBlockRead {
348- val blocksInChunk = blocksByChunk[event.chunk.position]
349- check(blocksInChunk != null ) { " Block autosave task was not cancelled properly" }
350- save(event.chunk, blocksInChunk)
351- }
352- delay(PylonConfig .entityDataAutosaveIntervalSeconds * 1000 )
345+ while (true ) {
346+ lockBlockRead {
347+ val blocksInChunk = blocksByChunk[event.chunk.position]
348+ check(blocksInChunk != null ) { " Block autosave task was not cancelled properly" }
349+ save(event.chunk, blocksInChunk)
353350 }
351+ delay(PylonConfig .entityDataAutosaveIntervalSeconds * 1000 )
354352 }
355353 }
356354 }
Original file line number Diff line number Diff line change @@ -136,13 +136,11 @@ object EntityStorage : Listener {
136136 // Wait a random delay before starting, this is to help smooth out lag from saving
137137 delay(Random .nextLong(PylonConfig .entityDataAutosaveIntervalSeconds * 1000 ))
138138
139- entityAutosaveTasks[entity.uuid] = PylonCore .launch(PylonCore .minecraftDispatcher) {
140- while (true ) {
141- lockEntityRead {
142- entity.write(entity.entity.persistentDataContainer)
143- }
144- delay(PylonConfig .entityDataAutosaveIntervalSeconds * 1000 )
139+ while (true ) {
140+ lockEntityRead {
141+ entity.write(entity.entity.persistentDataContainer)
145142 }
143+ delay(PylonConfig .entityDataAutosaveIntervalSeconds * 1000 )
146144 }
147145 }
148146 entity
You can’t perform that action at this time.
0 commit comments