Java Code Examples for org.bukkit.WorldCreator#type()

The following examples show how to use org.bukkit.WorldCreator#type() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArenaManager.java    From civcraft with GNU General Public License v2.0 6 votes vote down vote up
private static World createArenaWorld(ConfigArena arena, String name) {
	World world;
	world = Bukkit.getServer().getWorld(name);
	if (world == null) {
		WorldCreator wc = new WorldCreator(name);
		wc.environment(Environment.NORMAL);
		wc.type(WorldType.FLAT);
		wc.generateStructures(false);
		
		world = Bukkit.getServer().createWorld(wc);
		world.setAutoSave(false);
		world.setSpawnFlags(false, false);
		world.setKeepSpawnInMemory(false);
		ChunkCoord.addWorld(world);
	}
	
	return world;
}
 
Example 2
Source File: DResourceWorld.java    From DungeonsXL with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Generate a new DResourceWorld.
 *
 * @return the automatically created DEditWorld instance
 */
public DEditWorld generate() {
    int id = DInstanceWorld.counter;
    String name = DInstanceWorld.generateName(false, id);
    File folder = new File(Bukkit.getWorldContainer(), name);
    WorldCreator creator = new WorldCreator(name);
    creator.type(WorldType.FLAT);
    creator.generateStructures(false);

    DEditWorld editWorld = new DEditWorld(plugin, this, folder);
    this.editWorld = editWorld;

    EditWorldGenerateEvent event = new EditWorldGenerateEvent(editWorld);
    Bukkit.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        return null;
    }

    if (!RAW.exists()) {
        createRaw();
    }
    FileUtil.copyDir(RAW, folder, DungeonsXL.EXCLUDED_FILES);
    editWorld.generateIdFile();
    editWorld.world = creator.createWorld().getName();
    editWorld.generateIdFile();

    return editWorld;
}
 
Example 3
Source File: DResourceWorld.java    From DungeonsXL with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the "raw" world that is copied for new instances.
 */
public static void createRaw() {
    WorldCreator rawCreator = WorldCreator.name(".raw");
    rawCreator.type(WorldType.FLAT);
    rawCreator.generateStructures(false);
    World world = rawCreator.createWorld();
    File worldFolder = new File(Bukkit.getWorldContainer(), ".raw");
    FileUtil.copyDir(worldFolder, RAW, DungeonsXL.EXCLUDED_FILES);
    Bukkit.unloadWorld(world, /* SPIGOT-5225 */ !Version.isAtLeast(Version.MC1_14_4));
    FileUtil.removeDir(worldFolder);
}
 
Example 4
Source File: DebugWorldCommand.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
public void create_cmd() throws CivException {
	String name = getNamedString(1, "enter a world name");
	
	WorldCreator wc = new WorldCreator(name);
	wc.environment(Environment.NORMAL);
	wc.type(WorldType.FLAT);
	wc.generateStructures(false);
	
	World world = Bukkit.getServer().createWorld(wc);
	world.setSpawnFlags(false, false);
	ChunkCoord.addWorld(world);
	
	CivMessage.sendSuccess(sender, "World "+name+" created.");
	
}