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 {
49
49
val loc = bonfireRespawn.bonfireLocation
50
50
51
51
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
+ }
55
63
56
64
when {
57
65
bonfireEntity.isBonfire && player.uniqueId in bonfireData.bonfirePlayers -> {
@@ -72,6 +80,7 @@ class PlayerListener : Listener {
72
80
player.toGeary().remove<BonfireRespawn >()
73
81
}
74
82
}
83
+ chunk.removePluginChunkTicket(bonfire.plugin)
75
84
}
76
85
}
77
86
You can’t perform that action at this time.
0 commit comments