fix(EffectHandle): fix ConcurrentModificationException

This commit is contained in:
thehrz 2025-02-07 23:23:57 +08:00
parent f23a010a02
commit dfaedeabc2
Signed by: thehrz
GPG Key ID: C84CBCE7D5F88855

View File

@ -17,6 +17,7 @@ import org.koin.core.annotation.Single
import java.util.* import java.util.*
import java.util.logging.Level import java.util.logging.Level
@Single @Single
class EffectHandle( class EffectHandle(
private val configService: ConfigService, private val configService: ConfigService,
@ -435,11 +436,10 @@ class EffectHandle(
for (p in plugin.server.onlinePlayers) { for (p in plugin.server.onlinePlayers) {
gui.fixBar(p) gui.fixBar(p)
} }
for ((key, value) in infernalMobService.mountList) { for ((key, value) in infernalMobService.mountList.toMutableMap()) {
if (!key.isDead) { if (!key.isDead) {
if ((value.isDead) && ((key is LivingEntity))) { if ((value.isDead) && ((key is LivingEntity))) {
val fate = configService.mainConfig.mountFate val fate: String = configService.mainConfig.mountFate
if (fate == "death") { if (fate == "death") {
val le = key as LivingEntity? val le = key as LivingEntity?
le!!.damage(9.99999999E8) le!!.damage(9.99999999E8)