当前位置: 首页>>代码示例>>Java>>正文


Java WorldCreator.environment方法代码示例

本文整理汇总了Java中org.bukkit.WorldCreator.environment方法的典型用法代码示例。如果您正苦于以下问题:Java WorldCreator.environment方法的具体用法?Java WorldCreator.environment怎么用?Java WorldCreator.environment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.WorldCreator的用法示例。


在下文中一共展示了WorldCreator.environment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createArenaWorld

import org.bukkit.WorldCreator; //导入方法依赖的package包/类
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;
}
 
开发者ID:netizen539,项目名称:civcraft,代码行数:19,代码来源:ArenaManager.java

示例2: 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

示例3: 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

示例4: createWorld

import org.bukkit.WorldCreator; //导入方法依赖的package包/类
@Override
public World createWorld(WorldCreator creator) {
	World alreadyLoaded = this.getWorld(creator.name());
	if (alreadyLoaded != null) {
		return alreadyLoaded;
	}
	
	if (nukkit.isLevelGenerated(creator.name())) {
		nukkit.loadLevel(creator.name());
		World alreadyGenerated = this.getWorld(creator.name());
		return alreadyGenerated;
	}

	if (creator.environment() != Environment.NORMAL) {
		throw new IllegalArgumentException("No Nether or End support yet");
	}
	if (creator.generator() != null) {
		throw new IllegalArgumentException("Custom generators are not yet supported");
	}

	Map<String, Object> options = new HashMap<>();
	options.put("preset", creator.generatorSettings());
	if (!nukkit.generateLevel(creator.name(), creator.seed(), PokkitWorldType.toNukkit(creator.type()), options)) {
		throw new RuntimeException("Failed to create world " + creator.name());
	}
	World world = this.getWorld(creator.name());
	Pokkit.assertion(world != null, "World was still null");
	return world;
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:30,代码来源:CraftServer.java

示例5: importWorld

import org.bukkit.WorldCreator; //导入方法依赖的package包/类
public boolean importWorld(String name) {
    if(Bukkit.getServer().getWorld(name) == null) {
        if(this.configContainsWorld(name)) {
            this.loadWorld(name);
            return true;
        }

        File f = new File(Bukkit.getServer().getWorldContainer(), name);
        if(!f.exists() || !f.isDirectory()) {
            return false;
        }

        WorldCreator creator = new WorldCreator(name);
        if(name.endsWith("_nether")) {
            creator.environment(Environment.NETHER);
        } else if(name.endsWith("_the_end")) {
            creator.environment(Environment.THE_END);
        }

        World w = Bukkit.getServer().createWorld(creator);
        name = name.toLowerCase();
        this.createEntry(w);
        WorldData world = new WorldData(this.module, this, name);
        world.setWorld(w);
        this.worlds.put(name, world);
    }

    return true;
}
 
开发者ID:Steveice10,项目名称:Peacecraft,代码行数:30,代码来源:WorldManager.java

示例6: 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

示例7: 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

示例8: create_cmd

import org.bukkit.WorldCreator; //导入方法依赖的package包/类
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.");
	
}
 
开发者ID:netizen539,项目名称:civcraft,代码行数:16,代码来源:DebugWorldCommand.java

示例9: getWorldCreator

import org.bukkit.WorldCreator; //导入方法依赖的package包/类
public WorldCreator getWorldCreator(String name) {

        WorldCreator worldCreator = new WorldCreator(name);
        worldCreator.environment(environment);
        worldCreator.generateStructures(generateStructures);
        worldCreator.type(worldType);
        // worldCreator.seed(randomSeed());

        return worldCreator;
    }
 
开发者ID:Relicum,项目名称:Ipsum,代码行数:11,代码来源:WorldMaker.java

示例10: SGWorld

import org.bukkit.WorldCreator; //导入方法依赖的package包/类
public SGWorld(String name, String map) {
	this.name = name;
	displayName = map;

	wc = new WorldCreator(name);
	wc.environment(World.Environment.NORMAL);
	wc.type(WorldType.NORMAL);
}
 
开发者ID:SurvivalGamesDevTeam,项目名称:TheSurvivalGames,代码行数:9,代码来源:SGWorld.java

示例11: generateWorld

import org.bukkit.WorldCreator; //导入方法依赖的package包/类
@Override
protected World generateWorld()
{
    if (!TFM_ConfigEntry.GENERATE_FLATLANDS.getBoolean())
    {
        return null;
    }

    wipeFlatlandsIfFlagged();

    WorldCreator worldCreator = new WorldCreator(WORLD_NAME);
    worldCreator.generateStructures(false);
    worldCreator.type(WorldType.NORMAL);
    worldCreator.environment(World.Environment.NORMAL);
    worldCreator.generator(new CleanroomChunkGenerator(GENERATION_PARAMETERS));

    World world = Bukkit.getServer().createWorld(worldCreator);

    world.setSpawnFlags(false, false);
    world.setSpawnLocation(0, 50, 0);

    Block welcomeSignBlock = world.getBlockAt(0, 50, 0);
    welcomeSignBlock.setType(Material.SIGN_POST);
    org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState();

    org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();
    signData.setFacingDirection(BlockFace.NORTH);

    welcomeSign.setLine(0, ChatColor.GREEN + "Flatlands");
    welcomeSign.setLine(1, ChatColor.DARK_GRAY + "---");
    welcomeSign.setLine(2, ChatColor.YELLOW + "Spawn Point");
    welcomeSign.setLine(3, ChatColor.DARK_GRAY + "---");
    welcomeSign.update();

    TFM_GameRuleHandler.commitGameRules();

    return world;
}
 
开发者ID:Yoshi41023,项目名称:TatsuCraftMod,代码行数:39,代码来源:TFM_Flatlands.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: configureWorld

import org.bukkit.WorldCreator; //导入方法依赖的package包/类
@Override
public void configureWorld(WorldCreator worldCreator) {
    worldCreator.environment(info.dimension);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:InfoModule.java


注:本文中的org.bukkit.WorldCreator.environment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。