개인 자료란 (JE)

  서버 커뮤니티

Profile 오캣진 대표칭호 없음
Profile

질문하기 플러그인

버킷을 켜놓고 월드를 초기화할 수 있나요?

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

플러그인으로 플레이어가 죽으면 자동으로 새로운 월드를 생성하는 것을 만들려고 하는데

버킷을 켜놓고 월드를 초기화하는 것이 가능하나요?

3개의 댓글

0reo
2023.06.17

https://bukkit.org/threads/reset-world-on-command.486926/

오캣진
2023.06.17
@0reo

보고 명령어로 작성해 봤는데, 'An internal error occurred while attempting to perform this command' 라고 뜨네요. 위에 있는 걸로도 해봐도 변화가 없고 어떻게 해야 하나요??

 

public class ResetCommand implements CommandExecutor {

private Hardcore plugin;

 

public ResetCommand(Hardcore plugin) {

this.plugin = plugin;

}

@Override

public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

Player p = (Player) sender;

FileConfiguration config = plugin.getConfig();

World worldtp = Bukkit.getWorld(config.getString("Spawn.World"));

double x = config.getDouble("Spawn.X");

double y = config.getDouble("Spawn.Y");

double z = config.getDouble("Spawn.Z");

float yaw = (float) config.getDouble("Spawn.Yaw");

float pitch = (float) config.getDouble("Spawn.Pitch");

Location location = new Location(worldtp, x, y, z, yaw, pitch);

World world = p.getWorld(); // The world you want to reset

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

player.teleport(location);

}

 

String worldName = world.getName(); // The world name

 

if (!Bukkit.unloadWorld(world, false)) return false;

 

File worldFolder = new File(plugin.getDataFolder().getParentFile().getParentFile(), worldName); // World folder

worldFolder.delete(); // Delete world folder

 

Bukkit.createWorld(new WorldCreator(worldName)); // Create the world

 

return false;

}

}

0reo
2023.06.18
@오캣진

'An internal error occurred while attempting to perform this command' 는 명령어 실행시 오류나면 어디서든 띄워주는 오류 메세지구요, 아래에 내용을 알려주셔야 뭐라도 해결해볼거같네요

뉴스 및 창작물
/files/thumbnails/268/789/003/262x150.crop.jpg?20240515192032

레드스톤

벌레먹은 돌 빠르게 제거하는 법

GlassesFilm

2024-05-15

0

/files/thumbnails/797/788/003/262x150.crop.jpg?20240515090924

건축

마인크래프트로 구현한 카르카손 보드게임

Warak

2024-05-15

1

/files/thumbnails/487/784/003/262x150.crop.jpg?20240508233607

모드

Windows Borderless 모드에서 악성코드 발견 2

학교가기싫다

2024-05-08

1

/files/thumbnails/384/778/003/262x150.crop.jpg?20240512002324

업데이트

마인크래프트 자바 에디션 스냅샷 24w18a

학교가기싫다

2024-05-06

0

/files/thumbnails/855/781/003/262x150.crop.jpg?20240505141129

레드스톤

레이저 클리너

GlassesFilm

2024-05-05

1