當前位置: 首頁>>代碼示例>>Java>>正文


Java WorldCreator.createWorld方法代碼示例

本文整理匯總了Java中org.bukkit.WorldCreator.createWorld方法的典型用法代碼示例。如果您正苦於以下問題:Java WorldCreator.createWorld方法的具體用法?Java WorldCreator.createWorld怎麽用?Java WorldCreator.createWorld使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.WorldCreator的用法示例。


在下文中一共展示了WorldCreator.createWorld方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createWorld

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public World createWorld(ArcadeMap map) {
    WorldCreator creator = new WorldCreator(map.getWorldName())
            .environment(map.getEnvironment())
            .generateStructures(false)
            .generator(map.getGenerator().getChunkGenerator())
            .hardcore(false)
            .seed(map.getSeed())
            .type(map.getGenerator().getWorldType());

    World world = creator.createWorld();
    world.setAutoSave(false);
    world.setDifficulty(map.getDifficulty());
    world.setKeepSpawnInMemory(false);
    world.setPVP(map.isPvp());
    world.setSpawnFlags(false, false);
    world.setSpawnLocation(map.getSpawn().getBlockX(), map.getSpawn().getBlockY(), map.getSpawn().getBlockZ());

    map.setWorld(world);
    return world;
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:21,代碼來源:MapManager.java

示例2: execute

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
@Override
protected void execute(Event e) {
	Boolean FAWE = false;
	if (Bukkit.getWorld(world.getSingle(e)) != null) {
		Bukkit.unloadWorld(world.getSingle(e), true);
	}
	if (parsedSyntax.contains("async") && Skellett.instance.getConfig().getBoolean("Async", false)) FAWE = true;
	if (FAWE) {
		AsyncWorld FAWEworld = AsyncWorld.create(new WorldCreator(world.getSingle(e)));
		FAWEworld.commit();
	} else {
		WorldCreator creator = new WorldCreator(world.getSingle(e));
		if (generator != null) {
			creator.generator(generator.getSingle(e));
		}
		creator.createWorld();
	}
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:19,代碼來源:EffLoadCreateWorld.java

示例3: load

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public World load() {
    try {
        if (this.isLoaded()) {
            throw new IllegalStateException("World already loaded");
        } else if (WorldUtil.exists(this.worldName) == null) {
            throw new IllegalStateException("World does not exists");
        }
    } catch (final IOException e) {
        return null;
    }
    final WorldCreator creator = new WorldCreator(this.worldName);
    final World result = creator.createWorld();
    if (this.spawnLocation == null) {
        this.setSpawnLocation(result.getSpawnLocation());
    }
    this.setEnabled(true);
    return result;
}
 
開發者ID:Ribesg,項目名稱:NPlugins,代碼行數:19,代碼來源:GeneralWorld.java

示例4: create

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public void create() {
    arenaWorld = plugin.getServer().getWorld(Statics.ARENA_WORLD_NAME);
    if (arenaWorld == null) {
        plugin.getLogger().info("Loading world '" + Statics.ARENA_WORLD_NAME + "'.");
        WorldCreator arenaWorldCreator = new WorldCreator(Statics.ARENA_WORLD_NAME);
        arenaWorldCreator.generateStructures(false);
        arenaWorldCreator.generator(new VoidGenerator());
        arenaWorldCreator.type(WorldType.FLAT);
        arenaWorldCreator.seed(0);
        arenaWorld = arenaWorldCreator.createWorld();
        plugin.getLogger().info("Done loading world '" + Statics.ARENA_WORLD_NAME + "'.");
    } else {
        plugin.getLogger().info("The world '" + Statics.ARENA_WORLD_NAME + "' was already loaded.");
    }
    arenaWorld.setAutoSave(false);
    arenaWorld.getBlockAt(-5000, 45, -5000).setType(Material.STONE);
    arenaWorld.setSpawnLocation(-5000, 50, -5000);
    for (Map.Entry<String, String> entry : plugin.getConfiguration().getArenaGamerules().entrySet()) {
        arenaWorld.setGameRuleValue(entry.getKey(), entry.getValue());
    }
    arenaWorld.setTime(4000);
}
 
開發者ID:SkyWars,項目名稱:SkyWars,代碼行數:23,代碼來源:SkyWorldHandler.java

示例5: loadMap

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public void loadMap() {
	Chat.log(Prefix.LOG_WORLDS + "Generating world: " + worldName + "...");
	
	WorldCreator wc = new WorldCreator(worldName);
	wc.createWorld();
	
	getWorld().setAutoSave(false);
	getWorld().setKeepSpawnInMemory(false);
	getWorld().setFullTime(6000);
	
	for (Entity e : getWorld().getEntities())
		if (e instanceof Player == false)
			e.remove();
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:15,代碼來源:Map.java

示例6: loadLocalWorld

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
@Override
public void loadLocalWorld(@Nonnull String name) {
    WorldCreator wc = new WorldCreator(name);
    wc.environment(World.Environment.NORMAL); //TODO do we need support for environment in maps?
    wc.generateStructures(false);
    wc.type(WorldType.NORMAL);
    wc.generator(new CleanRoomChunkGenerator());
    wc.generatorSettings("");
    World world = wc.createWorld();
    world.setAutoSave(false);
}
 
開發者ID:VoxelGamesLib,項目名稱:VoxelGamesLib,代碼行數:12,代碼來源:BukkitWorldHandler.java

示例7: createWorld

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public void createWorld() {
    if (!name.isPresent()) {
        throw new UnsupportedOperationException("You must supply a name if you want to create a world using a nameless creator: " + this);
    }
    WorldCreator creator = new WorldCreator(name.get());
    creator.environment(dimension.toEnvironment());
    creator.type(type);
    creator.seed(seed.orElseGet(() -> new Random().nextLong()));
    generator.ifPresent(creator::generator);
    creator.generatorSettings(generatorSettings);
    creator.generateStructures(structures);
    creator.createWorld();
}
 
開發者ID:MundoSK,項目名稱:MundoSK,代碼行數:14,代碼來源:WorldCreatorData.java

示例8: loadWorld

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public World loadWorld()
{
  WorldCreator c = new WorldCreator(name);
  c.generateStructures(false);
  World localWorld = c.createWorld();
  localWorld.setAutoSave(false);
  localWorld.setKeepSpawnInMemory(false);
  localWorld.setGameRuleValue("doMobSpawning", "false");
  localWorld.setGameRuleValue("doDaylightCycle", "false");
  localWorld.setGameRuleValue("mobGriefing", "false");
  localWorld.setTime(0L);
  return localWorld;
}
 
開發者ID:SpikyBite,項目名稱:BiteSkywars,代碼行數:14,代碼來源:Arena.java

示例9: createBukkitWorld

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
private World createBukkitWorld(String name, long seed, String generator, Environment env, WorldType type, boolean genStructures, boolean providedSeed) {
    WorldCreator c = new WorldCreator(name);
    if(providedSeed) {
        c.seed(seed);
    }

    if(generator != null) {
        c.generator(generator);
    }

    c.environment(env);
    c.type(type);
    c.generateStructures(genStructures);
    return c.createWorld();
}
 
開發者ID:Steveice10,項目名稱:Peacecraft,代碼行數:16,代碼來源:WorldManager.java

示例10: loadBukkitWorld

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
private void loadBukkitWorld(WorldData world) {
    WorldCreator c = new WorldCreator(world.getName());
    c.seed(world.getSeed());
    if(world.hasGenerator()) {
        c.generator(world.getGenerator());
    }

    c.environment(world.getEnvironment());
    c.type(world.getType());
    c.generateStructures(world.generateStructures());
    c.createWorld();
}
 
開發者ID:Steveice10,項目名稱:Peacecraft,代碼行數:13,代碼來源:WorldManager.java

示例11: create

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public World create() {
	if (Bukkit.getServer().getWorld(name) != null) {
		int i = 0;
		while (true) {
			String s = name + i;
			if (Bukkit.getServer().getWorld(s) == null) {
				wc = new WorldCreator(s);
				break;
			}
			i++;
		}
	}

	return wc.createWorld();
}
 
開發者ID:SurvivalGamesDevTeam,項目名稱:TheSurvivalGames,代碼行數:16,代碼來源:SGWorld.java

示例12: getMap

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
public static World getMap() {
	WorldCreator wc = new WorldCreator(WORLD_NAME);
	wc.environment(Environment.NORMAL);
	wc.generator(new ChristmasChunkGenerator());
	wc.createWorld();
	World world =  Bukkit.getWorld(WORLD_NAME);
	if (map == null) {
		map = Bukkit.getServer().createWorld(wc);
	}
	return world;
}
 
開發者ID:EmilHernvall,項目名稱:tregmine,代碼行數:12,代碼來源:ChristmasMain.java

示例13: create

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
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;
}
 
開發者ID:Ribesg,項目名稱:NPlugins,代碼行數:35,代碼來源:GeneralWorld.java

示例14: loadWorld

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
@Override
public void loadWorld(String world, int flags) {
	WorldCreator create = new WorldCreator(world);
	switch (flags & ENV_FLAGS) {
	case NETHER_FLAG:
		create.environment(Environment.NETHER);
		break;
	case END_FLAG:
		create.environment(Environment.THE_END);
		break;
	case 0:
		create.environment(Environment.NORMAL);
		break;
	default:
		throw new IllegalArgumentException("Illegal env flag passed");
	}
	
	switch (flags & TYPE_FLAGS) {
	case FLAT_FLAG:
		create.type(WorldType.FLAT);
		break;
	case LARGE_BIOME_FLAG:
		create.type(WorldType.LARGE_BIOMES);
		break;
	case 0:
		create.type(WorldType.NORMAL);
		break;
	default:
		throw new IllegalArgumentException("Illegal type flag passed");
	}
	
	create.createWorld();
}
 
開發者ID:Minequest,項目名稱:Core-Bukkit,代碼行數:34,代碼來源:BukkitPlatform.java

示例15: onCommand

import org.bukkit.WorldCreator; //導入方法依賴的package包/類
@Override
public boolean onCommand(CommandSender sender, Command command, String[] args) {
    Validate.notNull(args[1]);
    if (Bukkit.getWorld(args[0]) != null) {
        sender.sendMessage(ChatColor.RED + "Error: world with that name already exists");
        return true;
    }


    Random random = new Random();

    long n = random.nextLong();

    Worlds worlds = new Worlds(plugin, args[0]);
    configManager.initConfig(args[0], worlds);
    worlds.setName(args[0]);
    worlds.setSeed(n);
    worlds.setGenerator(args[1]);
    WorldCreator worldCreator = new WorldCreator(args[0]);
    worldCreator.seed(n)
            .generateStructures(worlds.getGenerateStructures())
            .environment(worlds.getEnvironment())
            .type(worlds.getWorldType())
            .generator(args[1]);

    try {
        worlds.save();
        worldCreator.createWorld();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), () -> {
        if (Bukkit.getWorld(args[0]) != null)

            sender.sendMessage(ChatColor.GREEN + "New World Created Successfully");
        else {
            sender.sendMessage(ChatColor.RED + "Error creating new world");
        }
    }, 60l);


    return true;
}
 
開發者ID:Relicum,項目名稱:Ipsum,代碼行數:45,代碼來源:WorldCreate.java


注:本文中的org.bukkit.WorldCreator.createWorld方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。