개인 자료란 (JE)

  서버 커뮤니티

Profile kesswick 대표칭호 없음

kesswick1006 ead0919c59314658b6c69d91acfee3c4

Profile

커뮤니티 소통 개발하기 스크립트

집 스크립트

2025.07.08 조회 수 160 추천 수 0

여기에서 집설정한 주인이 게임에서 나가면 그 집이 부셔집니다.

어떻게 고치는지 아시는분

# ✅ /home 명령어로 자석석 지급

command /home:

    trigger:

        if {home::%player%} is set:

            send "&e이미 집이 등록되어 있습니다!"

            stop

        if player has lodestone:

            send "&a이미 자석석을 가지고 있습니다!"

            stop

        give player 1 lodestone

        send "&b자석석 1개를 지급했습니다. 원하는 곳에 설치하면 집이 등록됩니다!"


# ✅ 자석석 설치 시 집 등록 + 보호구역 검사 + 저장

on place of lodestone:

    loop all players:

        if {home::%loop-player%} is set:

            if distance between event-block and {home::%loop-player%} < 24:

                if player is not loop-player:

                    send "&c이 구역은 %loop-player% 님의 집 보호구역입니다!" to player

                    cancel event

                    stop


    if {home::%player%} is set:

        send "&c이미 집이 등록되어 있어 설치할 수 없습니다!" to player

        cancel event

        stop


    set {home::%player%} to location of event-block

    send "&a🏠 집이 등록되었습니다! 반경 24블록은 보호됩니다."


    # 저장

    set yaml value "homes.%uuid of player%.x" from file "homes.yml" to x-coordinate of event-block

    set yaml value "homes.%uuid of player%.y" from file "homes.yml" to y-coordinate of event-block

    set yaml value "homes.%uuid of player%.z" from file "homes.yml" to z-coordinate of event-block

    set yaml value "homes.%uuid of player%.world" from file "homes.yml" to world of event-block


# ✅ 자석석 파괴 시 집 제거 + 저장 제거

on break of lodestone:

    if {home::%player%} is set:

        set {_homeLoc} to {home::%player%}

        set {_blockLoc} to location of event-block

        if distance between {_blockLoc} and {_homeLoc} < 1:

            send "&c🏚️ 집이 제거되었습니다!" to player

            delete {home::%player%}

            delete {insideHome::%player%}

            delete yaml node "homes.%uuid of player%" from file "homes.yml"


# ✅ 자석석 버리기 방지

on player drop item:

    if dropped item is lodestone:

        cancel event

        send "&c자석석은 버릴 수 없습니다!" to player


# ✅ 건축 보호: 다른 사람 집에 설치/파괴 금지

on place:

    loop all players:

        if {home::%loop-player%} is set:

            if distance between event-block and {home::%loop-player%} < 24:

                if player is not loop-player:

                    cancel event

                    send "&c이 구역은 %loop-player% 님의 집입니다!" to player

                    stop


on break:

    loop all players:

        if {home::%loop-player%} is set:

            if distance between event-block and {home::%loop-player%} < 24:

                if player is not loop-player:

                    cancel event

                    send "&c이 구역은 %loop-player% 님의 집입니다!" to player

                    stop


# ✅ 1초마다 집 출입 체크 (본인 + 남의 집)

every 1 second:

    loop all players:

        set {_player} to loop-player

        set {_currentLoc} to location of {_player}

        set {_homeLoc} to {home::%{_player}%}


        # 본인 집

        if {_homeLoc} is set:

            if distance between {_homeLoc} and {_currentLoc} < 24:

                if {insideHome::%{_player}%} is not set:

                    send title "&a🏠 집에 들어왔습니다!" with subtitle "" to {_player}

                    set {insideHome::%{_player}%} to true

            else:

                if {insideHome::%{_player}%} is set:

                    send title "&7집에서 나갔습니다..." with subtitle "" to {_player}

                    delete {insideHome::%{_player}%}


        # 다른 사람 집

        loop all players:

            set {_owner} to loop-value

            if {_owner} != {_player}:

                if {home::%{_owner}%} is set:

                    set {_ownerLoc} to {home::%{_owner}%}

                    if distance between {_ownerLoc} and {_currentLoc} < 24:

                        if {insideOtherHome::%{_player}%} is not set or {insideOtherHome::%{_player}%} != {_owner}:

                            send title "&c%{_owner}% 님의 집에 들어왔습니다!" with subtitle "" to {_player}

                            set {insideOtherHome::%{_player}%} to {_owner}

                    else:

                        if {insideOtherHome::%{_player}%} is set and {insideOtherHome::%{_player}%} == {_owner}:

                            send title "&7%{_owner}% 님의 집에서 나갔습니다..." with subtitle "" to {_player}

                            delete {insideOtherHome::%{_player}%}


# ✅ /home reset: 자신의 집 제거

command /homereset:

    trigger:

        if {home::%player%} is set:

            delete {home::%player%}

            delete {insideHome::%player%}

            delete yaml node "homes.%uuid of player%" from file "homes.yml"

            send "&a집이 초기화되었습니다."

        else:

            send "&c등록된 집이 없습니다."


# ✅ 서버 시작 시 homes.yml 불러와서 집 복구

on load:

    loop yaml nodes "homes::*" from file "homes.yml":

        set {_uuid} to loop-value

        set {_x} to yaml value "homes.%{_uuid}%.x" from file "homes.yml"

        set {_y} to yaml value "homes.%{_uuid}%.y" from file "homes.yml"

        set {_z} to yaml value "homes.%{_uuid}%.z" from file "homes.yml"

        set {_world} to yaml value "homes.%{_uuid}%.world" from file "homes.yml"

        set {_loc} to location at {_x}, {_y}, {_z} in world {_world}

        set {home::%uuid of player with uuid {_uuid}%} to {_loc}

command /homeinfo:

    trigger:

        if {home::%player%} is set:

            set {_loc} to {home::%player%}

            send "&a📍 집 좌표 정보:"

            send "&7월드: &f%world of {_loc}%"

            send "&7X: &f%x-coordinate of {_loc}%"

            send "&7Y: &f%y-coordinate of {_loc}%"

            send "&7Z: &f%z-coordinate of {_loc}%"

        else:

            send "&c집이 등록되어 있지 않습니다!"





Warning
댓글이 없습니다.

새로운 댓글을 등록해 주세요!

뉴스 및 창작물
/files/thumbnails/472/161/004/262x150.crop.jpg?20260208155607

나의 GPU ☠️💀 1

SHALDOPlus

2026-02-08

0

/files/thumbnails/602/157/004/262x150.crop.jpg?20260130141854

상품

《마인크래프트 대탈출 게임 만들기》 출간!

다코미

2026-01-30

0

/files/thumbnails/873/156/004/262x150.crop.jpg?20260128131439

상품

《마인크래프트 블록 완벽 가이드》 출간!

다코미

2026-01-28

0

/files/thumbnails/317/150/004/262x150.crop.jpg?20260110144415

건축

광화문 구 경기도청사(1988)

창공

2026-01-10

2

/files/thumbnails/144/149/004/262x150.crop.jpg?20260107110106

상품

《레고 마인크래프트 비주얼 딕셔너리》 출간!

다코미

2026-01-07

0