Improved async ticks

This commit is contained in:
Auxilor
2022-03-17 17:13:17 +00:00
parent a9100a9348
commit f3499331b1
2 changed files with 8 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ class CrateDisplay(
fun start() {
plugin.scheduler.runTimer(1, 1) { tick() }
plugin.scheduler.runAsyncTimer(1, 1) { tickAsync() }
}
private fun tick() {
@@ -18,4 +19,10 @@ class CrateDisplay(
tick++
}
private fun tickAsync() {
for (crate in PlacedCrates.values()) {
crate.tickAsync(tick)
}
}
}

View File

@@ -24,10 +24,9 @@ class PlacedCrate(
internal fun tick(tick: Int) {
tick.toLong() // Just shut up, compiler
plugin.scheduler.runAsync { tickAsync(tick) }
}
private fun tickAsync(tick: Int) {
internal fun tickAsync(tick: Int) {
tickParticles(tick)
}