Package com.onarandombox.MultiverseCore

Examples of com.onarandombox.MultiverseCore.WorldProperties


        }

        // Obtain the world configuration information in MV
        MVWorldManager manager = core.getMVWorldManager();
        Map<String, WorldProperties> propsMap = SafeField.get(manager, "worldsFromTheConfig");
        WorldProperties world = propsMap.get(config.worldname);

        // Newly created world: no configuration in MV is available
        if (world == null) {
          MyWorlds.plugin.log(Level.WARNING, "World Configuration for '" + config.worldname +
              "' could not be imported from Multiverse: No configuration available");
          return false;
        }

        // Serialization could be incomplete - this is a (hackish) check for that
        try {
          world.getDifficulty();
        } catch (NullPointerException ex) {
          return false;
        }

        // Apply general world settings
        config.difficulty = world.getDifficulty();
        config.allowHunger = world.getHunger();
        config.forcedRespawn = !world.getBedRespawn();
        config.holdWeather = !world.isWeatherEnabled();
        config.pvp = world.isPVPEnabled();
        config.gameMode = world.getGameMode();
        config.keepSpawnInMemory = world.isKeepingSpawnInMemory();
        config.worldmode = WorldMode.get(config.worldmode.getType(), world.getEnvironment());
        config.setChunkGeneratorName(world.getGenerator());

        // Apply the (re)spawn point
        String respawnWorldName = world.getRespawnToWorld();
        WorldProperties respawnWorld = propsMap.get(respawnWorldName);
        if (respawnWorld == null) {
          respawnWorld = world;
          respawnWorldName = config.worldname;
        }
        Location respawnLoc = respawnWorld.getSpawnLocation();
        if (respawnLoc != null) {
          config.spawnPoint = new Position(respawnLoc);
          if (respawnLoc.getWorld() == null) {
            config.spawnPoint.setWorldName(respawnWorldName);
          }
View Full Code Here


            c.generateStructures(generateStructures);
        }

        // Important: doLoad() needs the MVWorld-object in worldsFromTheConfig
        if (!worldsFromTheConfig.containsKey(name)) {
            WorldProperties props = new WorldProperties(useSpawnAdjust, env);
            worldsFromTheConfig.put(name, props);
        }

        StringBuilder builder = new StringBuilder();
        builder.append("Loading World & Settings - '").append(name).append("'");
View Full Code Here

    private boolean doLoad(String name, boolean ignoreExists, WorldType type) {
        if (!worldsFromTheConfig.containsKey(name))
            throw new IllegalArgumentException("That world doesn't exist!");

        final WorldProperties world = worldsFromTheConfig.get(name);
        final WorldCreator creator = WorldCreator.name(name);

        creator.environment(world.getEnvironment()).seed(world.getSeed());
        if (type != null) {
            creator.type(type);
        }

        boolean generatorSuccess = true;
        if ((world.getGenerator() != null) && (!world.getGenerator().equals("null")))
            generatorSuccess = null != plugin.getUnsafeCallWrapper().wrap(new Callable<Object>() {
                @Override
                public Object call() throws Exception {
                    creator.generator(world.getGenerator());
                    return new Object();
                }
            }, "the generator plugin", "Failed to set the generator for world '%s' to '%s': %s", name, world.getGenerator());

        return generatorSuccess && doLoad(creator, ignoreExists);
    }
View Full Code Here

            this.plugin.log(Level.WARNING, "WorldManager: Can't load this world because the folder was deleted/moved: " + worldName);
            this.plugin.log(Level.WARNING, "Use '/mv remove' to remove it from the config!");
            return false;
        }

        WorldProperties mvworld = worldsFromTheConfig.get(worldName);
        World cbworld;
        try {
            cbworld = creator.createWorld();
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

    }

    private static final char SEPARATOR = '\uF8FF';

    public boolean isKeepingSpawnInMemory(World world) {
        WorldProperties properties = worldsFromTheConfig.get(world.getName());
        return properties == null || properties.isKeepingSpawnInMemory();
    }
View Full Code Here

            String key = worldKeys.pop();
            String path = "worlds" + SEPARATOR + key;
            Object obj = this.configWorlds.get(path);
            if ((obj != null) && (obj instanceof WorldProperties)) {
                String worldName = key.replaceAll(String.valueOf(SEPARATOR), ".");
                WorldProperties props = (WorldProperties) obj;
                if (this.worldsFromTheConfig.containsKey(worldName)) {
                    // Object-Recycling :D
                    // TODO Why is is checking worldsFromTheConfig and then getting from worlds?  So confused... (DTM)
                    MVWorld mvWorld = (MVWorld) this.worlds.get(worldName);
                    if (mvWorld != null) {
View Full Code Here

TOP

Related Classes of com.onarandombox.MultiverseCore.WorldProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.