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리스폰 장소로만 이동하고 끝나는데 혹시 추가 설명 가능한가여?
오캣진
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같은 시드로 생성되서 그럴거에요. 근처에 블록 설치하고 테스트해봐주시겠어요?