feat: エンティティ操作をリージョンunsafeで操作していた問題
This commit is contained in:
parent
ae4d23db7c
commit
3674586cfc
|
|
@ -5,12 +5,20 @@ import org.bukkit.GameMode
|
|||
class MannequinTickTask(private val registry: MannequinRegistry) {
|
||||
fun tick() {
|
||||
registry.all().forEach { record ->
|
||||
val location = record.location?.toLocation(registry.plugin.server) ?: return@forEach
|
||||
registry.plugin.server.regionScheduler.run(registry.plugin, location) { _ ->
|
||||
tickRecord(record)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun tickRecord(record: MannequinRecord) {
|
||||
val settings = record.settings
|
||||
val entity = registry.locate(record.id) ?: return@forEach
|
||||
if (!entity.isValid) return@forEach
|
||||
val entity = registry.locate(record.id) ?: return
|
||||
if (!entity.isValid) return
|
||||
|
||||
val location = entity.location
|
||||
val world = location.world ?: return@forEach
|
||||
val world = location.world ?: return
|
||||
|
||||
var targetDirection: org.bukkit.util.Vector? = null
|
||||
|
||||
|
|
@ -121,6 +129,5 @@ class MannequinTickTask(private val registry: MannequinRegistry) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user