public World create(org.bukkit.WorldType type) { if (type == null) { type = org.bukkit.WorldType.NORMAL; } try { if (WorldUtil.isLoaded(this.worldName) != null || WorldUtil.exists(this.worldName) != null) { throw new IllegalStateException("World already exists"); } } catch (final IOException e) { return null; } final WorldCreator creator = new WorldCreator(this.worldName); creator.seed(this.getSeed()); creator.type(type); switch (this.type) { case ADDITIONAL: case STOCK: creator.environment(World.Environment.NORMAL); break; case ADDITIONAL_SUB_NETHER: case STOCK_NETHER: creator.environment(World.Environment.NETHER); break; case ADDITIONAL_SUB_END: case STOCK_END: creator.environment(World.Environment.THE_END); break; default: throw new IllegalStateException("Incorrect world type: " + this.type); } final World result = creator.createWorld(); this.setSpawnLocation(result.getSpawnLocation()); return result; }
public boolean isLoaded() { return WorldUtil.isLoaded(this.worldName) != null; }