类org.bukkit.WorldType源码实例Demo

下面列出了怎么用org.bukkit.WorldType的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: uSkyBlock   文件: WorldManager.java
/**
 * Gets the skyblock island {@link World}. Creates and/or imports the world if necessary.
 * @return Skyblock island world.
 */
@NotNull
public synchronized World getWorld() {
    if (skyBlockWorld == null) {
        skyBlockWorld = Bukkit.getWorld(Settings.general_worldName);
        ChunkGenerator skyGenerator = getOverworldGenerator();
        ChunkGenerator worldGenerator = skyBlockWorld != null ? skyBlockWorld.getGenerator() : null;
        if (skyBlockWorld == null
                || skyBlockWorld.canGenerateStructures()
                || worldGenerator == null
                || !worldGenerator.getClass().getName().equals(skyGenerator.getClass().getName())) {
            skyBlockWorld = WorldCreator
                    .name(Settings.general_worldName)
                    .type(WorldType.NORMAL)
                    .generateStructures(false)
                    .environment(World.Environment.NORMAL)
                    .generator(skyGenerator)
                    .createWorld();
            skyBlockWorld.save();
        }
        MultiverseCoreHandler.importWorld(skyBlockWorld);
        setupWorld(skyBlockWorld, island_height);
    }
    return skyBlockWorld;
}
 
源代码2 项目: uSkyBlock   文件: WorldManager.java
/**
 * Gets the skyblock nether island {@link World}. Creates and/or imports the world if necessary. Returns null if
 * the nether is not enabled in the plugin configuration.
 * @return Skyblock nether island world, or null if nether is disabled.
 */
@Nullable
public synchronized World getNetherWorld() {
    if (skyBlockNetherWorld == null && Settings.nether_enabled) {
        skyBlockNetherWorld = Bukkit.getWorld(Settings.general_worldName + "_nether");
        ChunkGenerator skyGenerator = getNetherGenerator();
        ChunkGenerator worldGenerator = skyBlockNetherWorld != null ? skyBlockNetherWorld.getGenerator() : null;
        if (skyBlockNetherWorld == null
                || skyBlockNetherWorld.canGenerateStructures()
                || worldGenerator == null
                || !worldGenerator.getClass().getName().equals(skyGenerator.getClass().getName())) {
            skyBlockNetherWorld = WorldCreator
                    .name(Settings.general_worldName + "_nether")
                    .type(WorldType.NORMAL)
                    .generateStructures(false)
                    .environment(World.Environment.NETHER)
                    .generator(skyGenerator)
                    .createWorld();
            skyBlockNetherWorld.save();
        }
        MultiverseCoreHandler.importNetherWorld(skyBlockNetherWorld);
        setupWorld(skyBlockNetherWorld, island_height / 2);
        MultiverseInventoriesHandler.linkWorlds(getWorld(), skyBlockNetherWorld);
    }
    return skyBlockNetherWorld;
}
 
源代码3 项目: civcraft   文件: ArenaManager.java
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;
}
 
源代码4 项目: askyblock   文件: ASkyBlock.java
/**
 * @return the netherWorld
 */
public static World getNetherWorld() {
    if (netherWorld == null && Settings.createNether) {
        if (Settings.useOwnGenerator) {
            return Bukkit.getServer().getWorld(Settings.worldName +"_nether");
        }
        if (plugin.getServer().getWorld(Settings.worldName + "_nether") == null) {
            Bukkit.getLogger().info("Creating " + plugin.getName() + "'s Nether...");
        }
        if (!Settings.newNether) {
            netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.NORMAL).environment(World.Environment.NETHER).createWorld();
        } else {
            netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.FLAT).generator(new ChunkGeneratorWorld())
                    .environment(World.Environment.NETHER).createWorld();
        }
        netherWorld.setMonsterSpawnLimit(Settings.monsterSpawnLimit);
        netherWorld.setAnimalSpawnLimit(Settings.animalSpawnLimit);
    }
    return netherWorld;
}
 
源代码5 项目: VoxelGamesLibv2   文件: WorldHandler.java
/**
 * Loads a local world
 *
 * @param name the world to load
 * @return the loaded world
 * @throws WorldException if the world is not found or something else goes wrong
 */
@Nonnull
public World loadLocalWorld(@Nonnull String name) {
    log.finer("Loading world " + name);
    org.bukkit.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);
    return world;
}
 
源代码6 项目: DungeonsXL   文件: DResourceWorld.java
/**
 * 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;
}
 
源代码7 项目: DungeonsXL   文件: DResourceWorld.java
/**
 * 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);
}
 
源代码8 项目: civcraft   文件: DebugWorldCommand.java
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.");
	
}
 
源代码9 项目: askyblock   文件: ASkyBlock.java
/**
 * Returns the World object for the island world named in config.yml.
 * If the world does not exist then it is created.
 *
 * @return islandWorld - Bukkit World object for the ASkyBlock world
 */
public static World getIslandWorld() {
    if (islandWorld == null) {
        //Bukkit.getLogger().info("DEBUG worldName = " + Settings.worldName);
        //
        if (Settings.useOwnGenerator) {
            islandWorld = Bukkit.getServer().getWorld(Settings.worldName);
            //Bukkit.getLogger().info("DEBUG world is " + islandWorld);
        } else {
            islandWorld = WorldCreator.name(Settings.worldName).type(WorldType.FLAT).environment(World.Environment.NORMAL).generator(new ChunkGeneratorWorld())
                    .createWorld();
        }
        // Make the nether if it does not exist
        if (Settings.createNether) {
            getNetherWorld();
        }
        // Multiverse configuration
        if (!Settings.useOwnGenerator && Bukkit.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) {
            // Run sync
            if (!Bukkit.isPrimaryThread()) {
                Bukkit.getScheduler().runTask(plugin, ASkyBlock::registerMultiverse);
            } else {
                registerMultiverse();
            }
        }

    }
    // Set world settings
    if (islandWorld != null) {
        islandWorld.setWaterAnimalSpawnLimit(Settings.waterAnimalSpawnLimit);
        islandWorld.setMonsterSpawnLimit(Settings.monsterSpawnLimit);
        islandWorld.setAnimalSpawnLimit(Settings.animalSpawnLimit);
    }

    return islandWorld;
}
 
源代码10 项目: FastAsyncWorldedit   文件: AsyncWorld.java
@Override
public WorldType getWorldType() {
    return parent.getWorldType();
}
 
源代码11 项目: PacketWrapper   文件: WrapperPlayServerRespawn.java
/**
 * Retrieve the current level type.
 * @return The current level type
*/
public WorldType getLevelType() {
    return handle.getWorldTypeModifier().read(0);
}
 
源代码12 项目: PacketWrapper   文件: WrapperPlayServerRespawn.java
/**
 * Set see 0x01 login.
 * @param value - new world type.
*/
public void setLevelType(WorldType value) {
    handle.getWorldTypeModifier().write(0, value);
}
 
源代码13 项目: PacketWrapper   文件: WrapperPlayServerLogin.java
/**
 * Retrieve the world type.
 * <p>
 * This is the level-type settign (default, flat, or largeBiomes) in server.properties.
 * @return The current world type.
*/
public WorldType getLevelType() {
    return handle.getWorldTypeModifier().read(0);
}
 
源代码14 项目: PacketWrapper   文件: WrapperPlayServerLogin.java
/**
 * Set the world type.
 * <p>
 * This is the level-type settign (default, flat, or largeBiomes) in server.properties.
 * @param value - new value.
*/
public void setLevelType(WorldType type) {
    handle.getWorldTypeModifier().write(0, type);
}
 
 类所在包
 类方法
 同包方法