Java 类org.bukkit.WorldCreator 实例源码

项目:Arcade2    文件:MapManager.java   
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;
}
项目:SuperiorCraft    文件:Minigame.java   
public Minigame() {
    if (getLocation() != null) {
        Bukkit.getServer().createWorld(new WorldCreator(getLocation().getWorld().getName()));
    }

    if (isAutoStart()) {
        new BukkitRunnable() {

            @Override
            public void run() {
                if (players.size() >= minPlayers) {
                    System.out.println("AutoJoin Timer");
                    start();
                    cancel();
                }
            }

        }.runTaskTimer(SuperiorCraft.plugin, 10, 50);
    }

    Registry.registerListener(this);
    minigames.add(this);
}
项目:OpenUHC    文件:LobbyModule.java   
@Override
public void onEnable() {
  world = Bukkit.createWorld(new WorldCreator(OpenUHC.WORLD_DIR_PREFIX + "lobby"));
  // Read lobby yml if it exists
  File lobbyFile = new File(OpenUHC.WORLD_DIR_PREFIX + "lobby/lobby.yml");
  if (lobbyFile.exists()) {
    FileConfiguration lobbyConfig = YamlConfiguration.loadConfiguration(lobbyFile);
    ConfigurationSection spawn = lobbyConfig.getConfigurationSection("spawn");
    if (spawn != null) {
      double x = spawn.getDouble("x", 0);
      double y = spawn.getDouble("y", 64);
      double z = spawn.getDouble("z", 0);
      double r = spawn.getDouble("r", 1);
      this.spawn = new Vector(x, y, z);
      radius = (float) r;
    }
  }
  OpenUHC.registerEvents(this);
}
项目:mczone    文件:Map.java   
public void loadWorld() {
    new BukkitRunnable() {
        @Override
        public void run() {
            Bukkit.createWorld(new WorldCreator(getWorldName()));
            getWorld().setTime(6000 - (20 * 20));
            for (Location l : getSpawns())
                l.setWorld(getWorld());
            getSpecSpawn().setWorld(getWorld());

            for (Gamer g : Game.getTributes()) {
                g.clearVariable("parkour");
                g.setVariable("moveable", true);
                Location next = getNextSpawn(g.getPlayer());
                g.setVariable("spawn-block", next);

                g.teleport(next);
                g.setInvisible(false);
                g.setVariable("moveable", false);
                g.getPlayer().setHealth(20);
                g.clearInventory();
                g.clearScoreboard();
            }
        }
    }.runTask(SurvivalGames.getInstance());
}
项目:mczone    文件:WorldCmd.java   
@Override
  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    Player p = (Player) sender;

    if (args.length != 1) {
        Chat.player(sender, "&4[SG] &cPlease include the world name");
        return true;
    }

    String name = args[0];
    World w = Bukkit.getWorld(name);
    if (w == null)
        Bukkit.createWorld(new WorldCreator(name));
    w = Bukkit.getWorld(name);

    p.teleport(w.getSpawnLocation());
    Chat.player(sender, "&2[SG] &aTeleported to " + w.getName() + " spawn point");


return true;
  }
项目:SuperiorCraft    文件:Minigame.java   
public Minigame() {
    if (getLocation() != null) {
        Bukkit.getServer().createWorld(new WorldCreator(getLocation().getWorld().getName()));
    }

    if (isAutoStart()) {
        new BukkitRunnable() {

            @Override
            public void run() {
                if (players.size() >= minPlayers) {
                    System.out.println("AutoJoin Timer");
                    start();
                    cancel();
                }
            }

        }.runTaskTimer(SuperiorCraft.plugin, 10, 50);
    }

    Registry.registerListener(this);
    minigames.add(this);
}
项目:Cardinal    文件:CycleRunnable.java   
@Override
public void run() {
  Validate.notNull(map);
  Cardinal.getPluginLogger().info("Cycling to map " + map.getName());
  File dest = new File(Cardinal.getInstance().getDataFolder(), "matches/" + uuid.toString());
  dest.mkdir();
  try {
    copyDirectory(map.getDirectory(), dest);
  } catch (IOException ex) {
    ex.printStackTrace();
  }
  Cardinal.getPluginLogger().info(dest.getPath());
  World world = new WorldCreator(dest.getPath()).generator(new NullChunkGenerator()).createWorld();
  world.setPVP(true);
  this.world = world;
  this.matchFile = dest;
}
项目:Skellett    文件:EffLoadCreateWorld.java   
@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();
    }
}
项目:demigames    文件:SessionRegistry.java   
public Optional<World> setupWorld(Session session) {
    if (session instanceof LobbySession) {
        return Optional.of(Bukkit.getWorld(mainWorld));
    }
    if (session.getGame().isPresent()) {
        Game game = session.getGame().get();

        // Copy world from file
        File file = new File(INST.getDataFolder().getPath() + "/worlds/" + game.getDirectory() + "/");
        try {
            FileUtils.copyDirectory(file, new File(session.getId()), true);
        } catch (Exception oops) {
            oops.printStackTrace();
        }

        // Load new world
        Optional<World> world = Optional.ofNullable(new WorldCreator(session.getId()).createWorld());
        if (world.isPresent()) {
            world.get().setAutoSave(false);
        }

        return world;
    }
    return Optional.empty();
}
项目:beaconz    文件:Beaconz.java   
/**
 * Get the world that Beaconz runs in and if it doesn't exist, make it
 * @return
 */
public World getBeaconzWorld() {
    // Check to see if the world exists, and if not, make it
    if (beaconzWorld == null) {
        // World doesn't exist, so make it
        getLogger().info("World is '" + Settings.worldName + "'");
        try {
            beaconzWorld = WorldCreator.name(Settings.worldName).type(WorldType.NORMAL).environment(World.Environment.NORMAL).createWorld();
        } catch (Exception e) {
            getLogger().info("Could not make world yet..");
            return null;
        }
        if (!beaconzWorld.getPopulators().contains(getBp())) {
            beaconzWorld.getPopulators().add(getBp());
        }
    }
    // This is not allowed in this function as it can be called async
    //beaconzWorld.setSpawnLocation(Settings.xCenter, beaconzWorld.getHighestBlockYAt(Settings.xCenter, Settings.zCenter), Settings.zCenter);
    return beaconzWorld;
}
项目:libelula    文件:WorldManager.java   
public World loadWorld(String worldName) {
    World world = plugin.getServer().getWorld(worldName);
    if (world == null) {
        File worldDir = new File(worldName);
        if (worldDir.exists() && worldDir.isDirectory()) {
            WorldCreator creator = WorldCreator.name(worldName).seed(0).
                    environment(World.Environment.NORMAL);
            creator.generator(getEmptyWorldGenerator());
            world = Bukkit.createWorld(creator);
        }
    }
    if (world != null) {
        setDefaults(world);
    }
    return world;
}
项目:libelula    文件:WorldManager.java   
public World loadWorld(String worldName) {
    World world = plugin.getServer().getWorld(worldName);
    if (world == null) {
        File worldDir = new File(worldName);
        if (worldDir.exists() && worldDir.isDirectory()) {
            WorldCreator creator = WorldCreator.name(worldName).seed(0).
                    environment(World.Environment.NORMAL);
            creator.generator(getEmptyWorldGenerator());
            world = Bukkit.createWorld(creator);
        }
    }
    if (world != null) {
        setDefaults(world);
    }
    return world;
}
项目:gFeatures    文件:Enable.java   
public static void onEnable(){
    Bukkit.getLogger().info("[CTF] Enabled :D");
    ch.setupConfig();

    Capture c = new Capture();
    c.loop();
    Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getServer().getPluginManager().getPlugin("gFeatures"), new Runnable() {
        public void run(){
            WorldCreator cs = new WorldCreator("MinigameSpawn");
            Bukkit.getServer().createWorld(cs);

            WorldCreator cs1 = new WorldCreator("CTF");
            Bukkit.getServer().createWorld(cs1);

            CliotePing cp = new CliotePing();
            cp.sendMessage("mghello", "Bungee");
        }
       }, 40L);
}
项目:uSkyBlock    文件:uSkyBlock.java   
public World getWorld() {
    if (uSkyBlock.skyBlockWorld == null) {
        skyBlockWorld = Bukkit.getWorld(Settings.general_worldName);
        ChunkGenerator skyGenerator = getGenerator();
        ChunkGenerator worldGenerator = skyBlockWorld != null ? skyBlockWorld.getGenerator() : null;
        if (skyBlockWorld == null || skyBlockWorld.canGenerateStructures() ||
                worldGenerator == null || !worldGenerator.getClass().getName().equals(skyGenerator.getClass().getName()))
        {
            uSkyBlock.skyBlockWorld = WorldCreator
                    .name(Settings.general_worldName)
                    .type(WorldType.NORMAL)
                    .generateStructures(false)
                    .environment(World.Environment.NORMAL)
                    .generator(skyGenerator)
                    .createWorld();
            uSkyBlock.skyBlockWorld.save();
        }
        MultiverseCoreHandler.importWorld(skyBlockWorld);
        setupWorld(skyBlockWorld, island_height);
    }
    return uSkyBlock.skyBlockWorld;
}
项目:uSkyBlock    文件:uSkyBlock.java   
public World getSkyBlockNetherWorld() {
    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())) {
            uSkyBlock.skyBlockNetherWorld = WorldCreator
                    .name(Settings.general_worldName + "_nether")
                    .type(WorldType.NORMAL)
                    .generateStructures(false)
                    .environment(World.Environment.NETHER)
                    .generator(skyGenerator)
                    .createWorld();
            uSkyBlock.skyBlockNetherWorld.save();
        }
        MultiverseCoreHandler.importNetherWorld(skyBlockNetherWorld);
        setupWorld(skyBlockNetherWorld, island_height / 2);
        MultiverseInventoriesHandler.linkWorlds(getWorld(), skyBlockNetherWorld);
    }
    return skyBlockNetherWorld;
}
项目: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;
}
项目:acidisland    文件: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;
}
项目: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;
}
项目:PrivateWorlds    文件:CreateCommand.java   
public void run(Player player, String userWorldName)
{
    if(!hasPermission(player))
    {
        //Tell the player they do not have the required permissions.
        player.sendMessage(Language.UserLang.NO_PERMISSION);
        return;
    }


    if(PrivateWorlds.dataHandler.insertPlayerOwnedWorld(player.getUniqueId(), userWorldName) == DB_RETURN_CODE.SUCCESSFUL)
    {
        for(Player pPlayer : Bukkit.getServer().getOnlinePlayers())
        {
            pPlayer.sendMessage(Language.UserLang.WORLD_CREATING);
        }

        PrivateWorlds.plugin.getServer().createWorld(new WorldCreator("PW_" + player.getUniqueId().toString() + "_" + userWorldName.toLowerCase()));
        player.sendMessage(Language.UserLang.WORLD_CREATED_MESSAGE_PLAYER);
    }
    else
    {
        player.sendMessage(Language.UserLang.ERROR_OCCURRED);
    }   
}
项目:NPlugins    文件:GeneralWorld.java   
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;
}
项目:WeaselsWalls    文件:ReloadWorld.java   
@Override
public void onCommand(Player p, String[] args) {
    if(args.length == 0){
        for(WorldData wd : WorldManager.getInstance().allWorlds){
            try{
                Bukkit.unloadWorld(wd.getWorldName(), false);

                World world = Bukkit.getWorld(wd.getWorldName());

                WorldCreator creator = new WorldCreator(wd.getWorldName());
                world = creator.copy(wd.getWorld()).createWorld();
                world.setAutoSave(false);
            }catch(Exception e){
                WeaselsWalls.getPlugin().getLogger().log(Level.SEVERE, "Could not create world!");
                e.printStackTrace();
                return;
            }
            MessageManager.getInstance().msgPlayer(p, MessageTypes.GOOD, "Reloaded all worlds registered!");
            return;
        }
    }else if(args.length > 0){
        MessageManager.getInstance().msgPlayer(p, MessageTypes.SEVERE, "Too many arguments!");
        return;
    }
}
项目:SkyWars    文件:SkyWorldHandler.java   
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);
}
项目:ZentrelaRPG    文件:WorldBossManager.java   
@Override
public void initialize() {
    world = plugin.getServer().createWorld(new WorldCreator(SakiRPG.BOSS_WORLD));
    lobbyLoc = new Location(world, -249.5f, 112.5f, -945.5f, -180 + RMath.randInt(0, 3) * 90, 0);
    nextBossSpawnTime = System.currentTimeMillis() + getRandDelay();
    task();
    entryLocs = new Location[COORDS.length];
    for (int k = 0; k < COORDS.length; k++) {
        entryLocs[k] = new Location(world, COORDS[k][0], COORDS[k][1], COORDS[k][2], (float) COORDS[k][3], 0f);
    }
    instance = this;
}
项目:ZentrelaRPG    文件:NPCEntity.java   
public NPCEntity(int id, String name, NPCType type, double x, double y, double z, String world) {
    this.id = id;
    this.name = name;
    this.type = type;
    World w = NPCManager.plugin.getServer().getWorld(world);
    if (w == null) {
        NPCManager.plugin.getServer().createWorld(new WorldCreator(world));
        System.out.println("WARNING: NON-EXISTING WORLD: " + world + " - NOW GENERATING");
    }
    this.loc = new Location(w, x, y, z);
}
项目:Arcadia-Spigot    文件:MapRegistry.java   
public World loadWorld(GameMap gameMap) {
    String worldName = "game";
    if(this.currentWorld != null) {
        this.oldWorld = this.currentWorld;
        if(!this.currentWorld.getName().equalsIgnoreCase("game2")) {
            worldName = "game2";
        }
    }
    Arcadia.getPlugin(Arcadia.class).getLogger().info("[MapRegistry] [/] Copying map from " + gameMap.getMapDirectory().getPath() + "...");
    FileUtils.copyDirectory(gameMap.getMapDirectory().getAbsoluteFile(),
            new File(Bukkit.getWorldContainer().getPath() + "/" + worldName + "/"));
    Arcadia.getPlugin(Arcadia.class).getLogger().info("[MapRegistry] [/] Loading " + worldName + "...");
    this.currentWorld = Bukkit.getServer().createWorld(new WorldCreator(worldName));
    this.currentWorld.setAutoSave(false);
    currentWorld.setGameRuleValue("doFireTick", "false");
    currentWorld.setGameRuleValue("doMobSpawning", "false");
    currentWorld.setGameRuleValue("randomTickSpeed", "0");
    currentWorld.setGameRuleValue("doDaylightCycle", "false");
    for(Entity entity : currentWorld.getEntities()) {
        if(!(entity instanceof Player)) {
            entity.remove();
        }
    }
    this.mapBounds = new Cuboid(Utils.parseLocation((String) gameMap.fetchSetting("mapBoundsA")),
        Utils.parseLocation((String) gameMap.fetchSetting("mapBoundsB")));
    return this.currentWorld;
}
项目:bskyblock    文件:IslandWorld.java   
/**
 * Generates the Skyblock worlds.
 */
public IslandWorld(BSkyBlock plugin) {
    if (Settings.useOwnGenerator) {
        // Do nothing
        return;
    }
    if (plugin.getServer().getWorld(Settings.worldName) == null) {
        Bukkit.getLogger().info("Creating " + plugin.getName() + "'s Island World...");
    }
    // Create the world if it does not exist
    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.netherGenerate) {
        if (plugin.getServer().getWorld(Settings.worldName + "_nether") == null) {
            Bukkit.getLogger().info("Creating " + plugin.getName() + "'s Nether...");
        }
        if (!Settings.netherIslands) {
            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();
        }
    }
    // Make the end if it does not exist
    if (Settings.endGenerate) {
        if (plugin.getServer().getWorld(Settings.worldName + "_the_end") == null) {
            Bukkit.getLogger().info("Creating " + plugin.getName() + "'s End World...");
        }
        if (!Settings.endIslands) {
            endWorld = WorldCreator.name(Settings.worldName + "_the_end").type(WorldType.NORMAL).environment(World.Environment.THE_END).createWorld();
        } else {
            endWorld = WorldCreator.name(Settings.worldName + "_the_end").type(WorldType.FLAT).generator(new ChunkGeneratorWorld())
                    .environment(World.Environment.THE_END).createWorld();
        }
    }
    fixMultiverse(plugin);
}
项目:WC    文件:WorldManager.java   
/**
 * Create World.
 *
 * @param name the name of the world to create
 * @param environment the world Environment
 * @param preGenerate if the world is loaded or not
 */
public void createWorld(@NonNull String name, @NonNull World.Environment environment, boolean preGenerate){
    if (existWorld(name)) {
        plugin.debugLog("Este mundo ya existe");
        return;
    }
    World w = plugin.getServer().createWorld(new WorldCreator(name).environment(environment));
    plugin.debugLog("Mundo creado " + name);
    if (preGenerate){
        generateWorld(w, 500);
    }
    //More
}
项目:ProjectAres    文件:WorldManagerImpl.java   
@Override
public World createWorld(String worldName) throws ModuleLoadException, IOException {
    if(server.getWorlds().isEmpty()) {
        throw new IllegalStateException("Can't create a world because there is no default world to derive it from");
    }

    try {
        importDestructive(terrainOptions.worldFolder().toFile(), worldName);
    } catch(FileNotFoundException e) {
        // If files are missing, just inform the mapmaker.
        // Other IOExceptions are considered internal errors.
        throw new ModuleLoadException(e.getMessage()); // Don't set the cause, it's redundant
    }

    final WorldCreator creator = worldCreator(worldName);
    worldConfigurators.forEach(wc -> wc.configureWorld(creator));

    final World world = server.createWorld(creator);
    if(world == null) {
        throw new IllegalStateException("Failed to create world (Server.createWorld returned null)");
    }

    world.setAutoSave(false);
    world.setKeepSpawnInMemory(false);
    world.setDifficulty(Optional.ofNullable(mapInfo.difficulty)
                                .orElseGet(() -> server.getWorlds().get(0).getDifficulty()));

    return world;
}
项目:AlphaLibary    文件:Arena.java   
/**
 * Transforms the arena into a world
 */
public void loadArena() {
    Util.unzip(plugin.getDataFolder().getAbsolutePath() + "/arenas/" + fileName + ".zip", Bukkit.getWorlds().get(0).getWorldFolder().getParent());
    new BukkitRunnable() {
        public void run() {
            Bukkit.createWorld(new WorldCreator(fileName));

            for (ArenaFile.NotInitLocation notInitLocation : getSpawns()) {
                realSpawns.add(notInitLocation.realize());
            }
        }
    }.runTaskLater(AlphaLibary.getInstance(), 25);
}
项目:mczone    文件:Arena.java   
public void loadWorld() {
    new WorldCreator(worldName).createWorld();
    new WorldCreator(getCurrent().worldName).createWorld();
    getWorld().setAutoSave(false);
    setState(ArenaState.WAITING);

    for (Entity e : getWorld().getEntities())
        if (e instanceof Monster)
            e.remove();
}
项目:mczone    文件:ConfigAPI.java   
public Location getLocation(String s, String worldName) {
    String base = s + ".";
       double x = config.getDouble(base + "x");
    double y = config.getDouble(base + "y");
    double z = config.getDouble(base + "z");
    float yaw = (float) config.getDouble(base + "yaw");
    float pitch = (float) config.getDouble(base + "pitch");
       new WorldCreator(worldName).createWorld();
    World world = Bukkit.getWorld(worldName);
    Location r = new Location(world, x, y, z, yaw, pitch);
    return r;
}
项目:mczone    文件:ConfigAPI.java   
public Block getBlock(String s) {
    String base = s + ".";
       String world = config.getString(base + "world");
       int x = config.getInt(base + "x");
       int y = config.getInt(base + "y");
       int z = config.getInt(base + "z");

       new WorldCreator(world).createWorld();

    Block r = Bukkit.getWorld(world).getBlockAt(x, y, z);
    return r;
}
项目:mczone    文件:Map.java   
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();
}
项目:mczone    文件:Arena.java   
public void loadWorld() {
    new WorldCreator(worldName).createWorld();
    new WorldCreator(getCurrent().worldName).createWorld();
    getWorld().setAutoSave(false);
    setState(ArenaState.WAITING);

    for (Entity e : getWorld().getEntities())
        if (e instanceof Monster)
            e.remove();
}
项目: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) {
    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;
}
项目:VoxelGamesLib    文件:BukkitWorldHandler.java   
@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);
}
项目:MundoSK    文件:WorldCreatorData.java   
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();
}
项目:MundoSK    文件:WorldCreatorData.java   
public void createWorld(String name) {
    WorldCreator creator = new WorldCreator(name);
    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();
}
项目:MundoSK    文件:WorldManagementMundo.java   
public static void load() {
    Converters.registerConverter(World.class, WorldCreator.class, new Converter<World, WorldCreator>() {
        @Override
        public WorldCreator convert(World world) {
            WorldCreator worldCreator = new WorldCreator(world.getName());
            worldCreator.copy(world);
            worldCreator.type(world.getWorldType());
            worldCreator.generateStructures(world.canGenerateStructures());
            worldCreator.generatorSettings("");
            return worldCreator;
        }
    });
    Registration.registerEffect(EffCreateWorld.class, "create [new] world named %string%[( with|,)] [(dim[ension]|env[ironment]) %-dimension%][,] [seed %-string%][,] [type %-worldtype%][,] [gen[erator] %-string%][,] [gen[erator] settings %-string%][,] [struct[ures] %-boolean%]")
            .document("Create World", "1.6.4", "Creates a world with the specified name, optionally with a few settings. "
                    + "See the environment type and worldtype type for valid environments and worldtypes respectively. "
                    + "Generator settings can either be custom superflat codes or customized world codes (for customized world codes the worldtype needs to be 'customized').")
            .example("create world named \"Example\" with dimension nether, seed \"12345\", type flat, structures false");
    Registration.registerEffect(EffCreateWorldUsingCreator.class, "create [new] world [named %-string%] using %creator%")
            .document("Create World using Creator", "1.8", "Creates a world using the specified creator, optionally specifying the world's name (this is required if the creator doesn't specify a name)."
                    + "See the creator expressions for more information on how to specify the world's name and other settings. "
                    + "If a world with the name (specified or from the creator) already exists, this will just load that world instead of creating a new one.");
    Registration.registerEffect(EffUnloadWorld.class, "unload %world% [save %-boolean%]")
            .document("Unload World", "Before 1.4", "Unloads the specified world. You can specify whether or not to save before unloading (this defaults to true).");
    Registration.registerEffect(EffDeleteWorld.class, "delete %world%")
            .document("Delete World", "Before 1.4", "Deletes the specified world. The specified world must be loaded in order to be deleted.");
    Registration.registerEffect(EffDuplicateWorld.class, "duplicate %world% (with|using) name %string%")
            .document("Duplicate World", "Before 1.4", "Creates a copy of the specified world using the specified string as a name. The specified world must be loaded in order for this to work.");
    Registration.registerExpression(ExprCurrentWorlds.class,World.class, ExpressionType.SIMPLE,"[all] current worlds")
            .document("All Current Worlds", "1.8", "An expression for all worlds that are currently loaded. "
                    + "This differs from Skript's 'all worlds' expression in that it still parses as being a list even if there is only one world at the time of parsing.");

    loadWorldLoader();
}
项目:BiteSkywars    文件:Arena.java   
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;
}