개인 자료란 (JE)

  서버 커뮤니티

Profile 오캣진 대표칭호 없음
Profile

질문하기 Java

플레이어가 죽으면 세계를 리셋하는 방법

2023.06.17 조회 수 51 추천 수 0
이해도 초보자 
게임버전 (JE) 1.20 
게임버전 (BE) 관련없음 

플러그인으로 플레이어가 죽으면 서버를 종료하지 않고 새 월드로 초기화하는 방법이 있을까요?

4개의 댓글

윈초
2023.06.18
World world = player.getWorld();
Bukkit.unloadWorld(world, false);

Bukkit.createWorld(new WorldCreator(world.getName()).type(WorldType.NORMAL));
World newWorld = Bukkit.getWorld(world.getName());

for (Player player : Bukkit.getOnlinePlayers()) {
    player.teleport(newWorld.getSpawnLocation());
}
오캣진
2023.06.18
@윈초

리스폰 장소로만 이동하고 끝나는데 혹시 추가 설명 가능한가여?

오캣진
2023.06.18
@오캣진

코드입니다.

 

@EventHandler

public void onPlayerDeath(PlayerDeathEvent event) {

Player player = event.getEntity();

String playerName = player.getName();

 

// Show "Dead Player" in the title for 3 seconds

showSupTitle(player, ChatColor.RED + "[ 사망 ]", "범인 : " + playerName , 3);

 

// Schedule a task to display the countdown

new BukkitRunnable() {

int time = 10;

 

@Override

public void run() {

if (time == 0) {

// Clear the title after the countdown ends

player.sendTitle("", "", 0, 20, 10);

World world = player.getWorld();

Bukkit.unloadWorld(world, false);

 

Bukkit.createWorld(new WorldCreator(world.getName()).type(WorldType.NORMAL));

World newWorld = Bukkit.getWorld(world.getName());

 

for (Player allplayer : Bukkit.getOnlinePlayers()) {

allplayer.teleport(newWorld.getSpawnLocation());

}

cancel();

return;

}

// Update the title with the remaining countdown time

showSupTitle(player, ChatColor.GREEN + "[ 서버 초기화 ]", time + "초" , 0);

time--;

}

}.runTaskTimer(this, 60, 20); // Run the task every second

}

윈초
2023.06.18
@오캣진

같은 시드로 생성되서 그럴거에요. 근처에 블록 설치하고 테스트해봐주시겠어요?

뉴스 및 창작물
/files/thumbnails/855/781/003/262x150.crop.jpg?20240505141129

레드스톤

레이저 클리너

GlassesFilm

2024-05-05

0

/files/thumbnails/576/775/003/262x150.crop.jpg?20240426232553

아티클

이달의 블록: 단단한 진흙

학교가기싫다

2024-04-26

0

/files/thumbnails/115/774/003/262x150.crop.jpg?20240428135129

업데이트

마인크래프트 1.20.5 정식 업데이트

학교가기싫다

2024-04-24

0

/files/thumbnails/762/770/003/262x150.crop.jpg?20240418073724

레드스톤

T.B.H (고민중독) | 노트블럭 버전 | NoteBlock Cover [한국어 영어 중국어 가사 추가]

노트블럭전문가

2024-04-18

0

/files/thumbnails/218/767/003/262x150.crop.jpg?20240412130213

레드스톤

우리의 꿈 - 원피스 오프닝

노트블럭전문가

2024-04-12

0