Skip to content

Commit

Permalink
V1.0.5 修复玩家退出区域清除Tick任务
Browse files Browse the repository at this point in the history
  • Loading branch information
YsGqHY committed Feb 21, 2024
1 parent fc66438 commit 4e75902
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/main/kotlin/kim/hhhhhy/regions/data/AreaSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import taboolib.common5.mirrorNow
import taboolib.module.configuration.Config
import taboolib.module.configuration.Configuration
import taboolib.module.lang.sendInfo
import taboolib.platform.util.onlinePlayers
import java.util.concurrent.ConcurrentHashMap
import kotlin.math.max
import kotlin.math.min
Expand All @@ -40,7 +41,6 @@ data class AreaSettings(
private val playerAreas = ConcurrentHashMap<String, MutableMap<String, PlatformExecutor.PlatformTask>>()

fun reloadArea() {
playerAreas.clear()
areasData.clear()
val section = areasConfig.getConfigurationSection("Areas") ?: return
section.getKeys(false).forEach { id ->
Expand All @@ -50,6 +50,11 @@ data class AreaSettings(
val tickPeriod = root.getLong("tickPeriod", ConfigSettings.config.getLong("AreaSettings.TickAction", 20))
areasData[id] = AreaSettings(position, actions, tickPeriod)
}
playerAreas.clear()
onlinePlayers.forEach {
stopTick(it)
check(it, it.location)
}
console().sendInfo("plugin-areas-reload")
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 触发冷却
CommandBaffle:
# 毫秒
time: 3000
time: 1000

AreaSettings:
# 区域内持续执行
Expand Down

0 comments on commit 4e75902

Please sign in to comment.