当前位置: 首页>>代码示例>>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;未经允许,请勿转载。