Kotlin
Minecraft

마인크래프트 플러그인 관련 질문

be

beobma
답변 완료
30 XP
@EventHandler
    fun onPlayerMove(event: PlayerMoveEvent) {
        val player = event.player
        val playerName = player.name
        val location = player.location
        val isInZone = location.isInNoPVPZone()

        if (isInZone && !playersInZone.contains(playerName)) {
            sendTitle(player, "${ChatColor.BOLD}시작의 마을", "${ChatColor.GREEN}${ChatColor.BOLD}안전 구역", 10, 40, 10)
            playersInZone.add(playerName)
        } else if (!isInZone && playersInZone.contains(playerName)) {
            sendTitle(player, "${ChatColor.BOLD}마을에서 벗어났습니다.", "", 10, 40, 10)
            playersInZone.remove(playerName)
        }
    }

소스 코드입니다.

특정 구역 내에 플레이어가 들어오면 메시지를 띄우고 싶어서 저런 코드를 작성했는데,

이렇게 하니까 어디에서나 플레이어가 움직이기만 하면 저 함수가 실행되니까 심각한 렉이 발생하더라고요.

해결할 방법이 있을까요?


불러오는 중...