File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
src/main/kotlin/com/mineinabyss/bonfire/listeners Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -49,9 +49,17 @@ class PlayerListener : Listener {
4949 val loc = bonfireRespawn.bonfireLocation
5050
5151 loc.world.getChunkAtAsyncUrgently(loc).thenAccept { chunk ->
52- val bonfireEntity =
53- chunk.entities.filterIsBonfire().find { it.uniqueId == bonfireRespawn.bonfireUuid } ? : return @thenAccept
54- val bonfireData = bonfireEntity.toGeary().get<Bonfire >() ? : return @thenAccept
52+ chunk.addPluginChunkTicket(bonfire.plugin)
53+ val bonfireEntity = chunk.entities.filterIsBonfire().find { it.uniqueId == bonfireRespawn.bonfireUuid }
54+ if (bonfireEntity == null ) {
55+ chunk.removePluginChunkTicket(bonfire.plugin)
56+ return @thenAccept
57+ }
58+ val bonfireData = bonfireEntity.toGeary().get<Bonfire >()
59+ if (bonfireData == null ) {
60+ chunk.removePluginChunkTicket(bonfire.plugin)
61+ return @thenAccept
62+ }
5563
5664 when {
5765 bonfireEntity.isBonfire && player.uniqueId in bonfireData.bonfirePlayers -> {
@@ -72,6 +80,7 @@ class PlayerListener : Listener {
7280 player.toGeary().remove<BonfireRespawn >()
7381 }
7482 }
83+ chunk.removePluginChunkTicket(bonfire.plugin)
7584 }
7685 }
7786
You can’t perform that action at this time.
0 commit comments