public void onEnable() {
    //        PluginManager pm = getServer().getPluginManager();
    //        pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Event.Priority.Normal, this);
    //        pm.registerEvent(Event.Type.WORLD_INIT, worldListener, Event.Priority.High, this);
    //        reload();

    World bio = getServer().getWorld("biosphere");
    if (null == bio) {
      //            BiosphereGenerator gen = new BiosphereGenerator();
      //            bio =
      // getServer().createWorld("biosphere",Environment.NORMAL,getServer().getWorlds().get(0).getSeed(), gen);
      /*
      WorldCreator wc = new WorldCreator("biosphere");
         wc.environment(Environment.NORMAL);
         wc.seed(getServer().getWorlds().get(0).getSeed());
         wc.generator((ChunkGenerator) (bio = getServer().createWorld(wc)));
         */
      WorldCreator wc = new WorldCreator("biosphere");
      wc.environment(Environment.NORMAL);
      wc.seed(getServer().getWorlds().get(0).getSeed());
      BiosphereGenerator gen = new BiosphereGenerator();
      wc.generator(gen);
      System.out.printf("start making world");
      bio = getServer().createWorld(wc);
    }

    // Register our commands
    getCommand("biosphere").setExecutor(new BiosphereCommand(this));
    getCommand("biome").setExecutor(new BiomeCommand(this));
    getCommand("test").setExecutor(new TestCommand(this));

    PluginDescriptionFile pdfFile = this.getDescription();
    System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " enabled");
  }
 public static void createNewWorld(String name, Rank rank) {
   World world = Bukkit.getWorld(name);
   if (world == null) {
     WorldCreator creator = new WorldCreator(name);
     world = creator.createWorld();
     worlds.put(world, rank);
     guestlists.put(world, new FOPMR_GuestList());
   }
 }
Beispiel #3
0
  public void load() {
    WorldCreator creator = WorldCreator.name(this.worldName);
    creator.environment(Environment.NORMAL);
    creator.generator("CleanroomGenerator:.");
    this.world = creator.createWorld();
    world.setAutoSave(false);

    // new Location(this.world, this.X, this.Y, this.Z);

  }
Beispiel #4
0
  private World createWorld() {
    WorldCreator worldCreator = new WorldCreator(WORLD_NAME);
    try {
      worldCreator.generator(new DungeonChunkGenerator());
    } catch (DungeonArgumentException argumentException) {
      log.log(Level.SEVERE, "Couldn't initialize chunk generator", argumentException);
    }
    worldCreator.environment(Environment.NORMAL);

    return Bukkit.getServer().createWorld(worldCreator);
  }
Beispiel #5
0
  /** Starts this server. */
  public void start() {
    // Config should have already loaded by this point, but to be safe...
    config.load();
    consoleManager.setupConsole();

    // Load player lists
    opsList.load();
    whitelist.load();
    banManager.load();

    // Start loading plugins
    loadPlugins();

    // Begin registering permissions
    DefaultPermissions.registerCorePermissions();

    // Register these first so they're usable while the worlds are loading
    GlowCommandMap.initGlowPermissions(this);
    commandMap.register(new MeCommand(this));
    commandMap.register(new ColorCommand(this));
    commandMap.register(new KickCommand(this));
    commandMap.register(new ListCommand(this));
    commandMap.register(new TimeCommand(this));
    commandMap.register(new WhitelistCommand(this));
    commandMap.register(new BanCommand(this));
    commandMap.register(new GameModeCommand(this));
    commandMap.register(new OpCommand(this));
    commandMap.register(new DeopCommand(this));
    commandMap.register(new StopCommand(this));
    commandMap.register(new SaveCommand(this));
    commandMap.register(new SayCommand(this));
    commandMap.removeAllOfType(ReloadCommand.class);
    commandMap.register(new ReloadCommand(this));
    commandMap.register(new HelpCommand(this, commandMap.getKnownCommands(false)));

    enablePlugins(PluginLoadOrder.STARTUP);

    // Create worlds
    String world = config.getString("server.world-name", "world");
    createWorld(WorldCreator.name(world).environment(Environment.NORMAL));
    if (getAllowNether()) {
      createWorld(WorldCreator.name(world + "_nether").environment(Environment.NETHER));
    }
    if (getAllowEnd()) {
      createWorld(WorldCreator.name(world + "_the_end").environment(Environment.THE_END));
    }

    // Finish loading plugins
    enablePlugins(PluginLoadOrder.POSTWORLD);
    commandMap.registerServerAliases();
    consoleManager.refreshCommands();
  }
  public void open() {
    if (this.args.length == 2) {
      String worldName = this.args[1];
      World world = Bukkit.getWorld(worldName);
      if (world == null) {
        message("World <" + worldName + "> was not loaded. Loading world...");
        world = Bukkit.createWorld(WorldCreator.name(worldName));
        message("World <" + worldName + "> loaded");
      }
      if (this.editor.getWorlds().keySet().contains(world)) {
        message("World <" + worldName + "> is already openned in editor");
        return;
      }

      try {
        this.editor.addWorld(world);

      } catch (IOException e) {
        message("Error loading script map for world <" + worldName + ">...");
        e.printStackTrace();
        return;
      }

      this.editor.buildSigns(world);

      message("World <" + worldName + "> openned in editor");
      NSCore.log("World <" + worldName + "> openned in editor by " + this.sender.getName());
    }
  }
Beispiel #7
0
  public boolean load(Match match) {
    String name = "match-" + match.getID();
    File copyto = new File(name);
    try {
      FileUtil.copy(getFolder(), copyto);
      File sessionLock = new File(copyto.getAbsolutePath() + "/session.lock");
      if (sessionLock.exists()) {
        FileUtil.delete(sessionLock);
      }
      File uid = new File(copyto.getAbsolutePath() + "/uid.dat");
      if (uid.exists()) {
        FileUtil.delete(uid);
      }
      File old = new File(copyto.getAbsolutePath() + "/level.dat_old");
      if (old.exists()) {
        FileUtil.delete(old);
      }
    } catch (IOException e) {
      e.printStackTrace();
      return false;
    }

    WorldCreator creator = new WorldCreator(name);
    creator.generator(new NullChunkGenerator());
    this.world = creator.createWorld();

    startModules(ModuleStage.LOAD);
    this.timer.setMatch(match);

    scoreboard();
    for (VisibleRegion region : visible) {
      region.set(world);
    }

    for (VisibleRegion region : visible) {
      Log.info(
          "Using "
              + region.getMaterial().name()
              + ":"
              + region.getDye().name()
              + " for "
              + region.getRegion());
    }

    return true;
  }
Beispiel #8
0
 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;
 }
Beispiel #9
0
 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;
 }
Beispiel #10
0
  private static World createMatchWorld(AutoRefMap map, String world) throws IOException {
    if (world == null) world = AutoReferee.WORLD_PREFIX + Long.toHexString(new Date().getTime());

    // copy the files over and return the loaded world
    map.unpack(new File(world));
    return AutoReferee.getInstance()
        .getServer()
        .createWorld(
            WorldCreator.name(world).generateStructures(false).generator(new NullChunkGenerator()));
  }
Beispiel #11
0
  /**
   * Creates or loads a world with the given name using the specified options.
   *
   * <p>If the world is already loaded, it will just return the equivalent of
   * getWorld(creator.name()).
   *
   * @param creator Options to use when creating the world
   * @return Newly created or loaded world
   */
  public GlowWorld createWorld(WorldCreator creator) {
    GlowWorld world = getWorld(creator.name());
    if (world != null) {
      return world;
    }

    if (creator.generator() == null) {
      creator.generator(getGenerator(creator.name(), creator.environment()));
    }

    world =
        new GlowWorld(
            this,
            creator.name(),
            creator.environment(),
            creator.seed(),
            new McRegionWorldStorageProvider(new File(getWorldContainer(), creator.name())),
            creator.generator());
    worlds.add(world);
    return world;
  }
  /**
   * Creates the world and the tower of SkyBlock.
   *
   * @return world instance of SkyBlock
   */
  public World getSkyBlockWorld() {
    if (this.skyBlockWorld == null) {
      boolean folderExists =
          new File(SkyBlockMultiplayer.getInstance().settings.getWorldName()).exists();
      this.skyBlockWorld =
          WorldCreator.name(this.settings.getWorldName())
              .type(WorldType.FLAT)
              .environment(Environment.NORMAL)
              .generator(new SkyBlockChunkGenerator())
              .createWorld();
      if (!folderExists) {
        File f = new File(this.settings.getIslandSchematic());
        if (f.exists() && f.isFile()) {
          try {
            CreateIsland.createStructure(
                new Location(getSkyBlockWorld(), 0, this.settings.getTowerYPosition(), 0), f);
            this.skyBlockWorld.setSpawnLocation(0, this.skyBlockWorld.getHighestBlockYAt(0, 0), 0);
            return this.skyBlockWorld;
          } catch (Exception e) {
            e.printStackTrace();
            SpawnTower.createSpawnTower();
            this.skyBlockWorld.setSpawnLocation(1, this.skyBlockWorld.getHighestBlockYAt(1, 1), 1);
            return this.skyBlockWorld;
          }
        }

        f =
            new File(
                SkyBlockMultiplayer.getInstance().getDataFolder(),
                this.settings.getTowerSchematic());
        if (f.exists() && f.isFile()) {
          try {
            CreateIsland.createStructure(
                new Location(getSkyBlockWorld(), 0, this.settings.getTowerYPosition(), 0), f);
            this.skyBlockWorld.setSpawnLocation(0, this.skyBlockWorld.getHighestBlockYAt(0, 0), 0);
            return this.skyBlockWorld;
          } catch (Exception e) {
            e.printStackTrace();
            SpawnTower.createSpawnTower();
            this.skyBlockWorld.setSpawnLocation(1, this.skyBlockWorld.getHighestBlockYAt(1, 1), 1);
            return this.skyBlockWorld;
          }
        }

        SpawnTower.createSpawnTower();
        this.skyBlockWorld.setSpawnLocation(1, this.skyBlockWorld.getHighestBlockYAt(1, 1), 1);
        return this.skyBlockWorld;
      }
    }
    return this.skyBlockWorld;
  }
  @Override
  protected World generateWorld() {
    if (!TFM_ConfigEntry.FLATLANDS_GENERATE.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 + "DonatorWorld");
    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;
  }
  @Override
  public GlowWorld createWorld(WorldCreator creator) {
    GlowWorld world = getWorld(creator.name());
    if (world != null) {
      return world;
    }

    if (creator.generator() == null) {
      creator.generator(getGenerator(creator.name(), creator.environment(), creator.type()));
    }

    // GlowWorld's constructor calls addWorld below.
    return new GlowWorld(this, creator);
  }
  /**
   * Gets the default ChunkGenerator for the given environment and type.
   *
   * @return The ChunkGenerator.
   */
  private ChunkGenerator getGenerator(String name, Environment environment, WorldType type) {
    // find generator based on configuration
    ConfigurationSection worlds = config.getWorlds();
    if (worlds != null) {
      String genName = worlds.getString(name + ".generator", null);
      ChunkGenerator generator =
          WorldCreator.getGeneratorForName(name, genName, getConsoleSender());
      if (generator != null) {
        return generator;
      }
    }

    // find generator based on environment and world type
    if (environment == Environment.NETHER) {
      return new net.glowstone.generator.UndergroundGenerator();
    } else if (environment == Environment.THE_END) {
      return new net.glowstone.generator.CakeTownGenerator();
    } else {
      return new net.glowstone.generator.SurfaceGenerator();
    }
  }
  /** Starts this server. */
  public void start() {
    // Determine console mode and start reading input
    consoleManager.startConsole(config.getBoolean(ServerConfig.Key.USE_JLINE));
    consoleManager.startFile(config.getString(ServerConfig.Key.LOG_FILE));

    if (getProxySupport()) {
      if (getOnlineMode()) {
        logger.warning("Proxy support is enabled, but online mode is enabled.");
      } else {
        logger.info("Proxy support is enabled.");
      }
    } else if (!getOnlineMode()) {
      logger.warning(
          "The server is running in offline mode! Only do this if you know what you're doing.");
    }

    // Load player lists
    opsList.load();
    whitelist.load();
    nameBans.load();
    ipBans.load();

    // DRAGONET-Start
    this.dragonetServer = new DragonetServer(this);
    this.dragonetServer.initialize();
    // DRAGONET-End

    // Start loading plugins
    loadPlugins();
    enablePlugins(PluginLoadOrder.STARTUP);

    // Create worlds
    String name = config.getString(ServerConfig.Key.LEVEL_NAME);
    String seedString = config.getString(ServerConfig.Key.LEVEL_SEED);
    boolean structs = getGenerateStructures();
    WorldType type = WorldType.getByName(getWorldType());
    if (type == null) {
      type = WorldType.NORMAL;
    }

    long seed = new Random().nextLong();
    if (!seedString.isEmpty()) {
      try {
        long parsed = Long.parseLong(seedString);
        if (parsed != 0) {
          seed = parsed;
        }
      } catch (NumberFormatException ex) {
        seed = seedString.hashCode();
      }
    }

    createWorld(
        WorldCreator.name(name)
            .environment(Environment.NORMAL)
            .seed(seed)
            .type(type)
            .generateStructures(structs));
    if (getAllowNether()) {
      createWorld(
          WorldCreator.name(name + "_nether")
              .environment(Environment.NETHER)
              .seed(seed)
              .type(type)
              .generateStructures(structs));
    }
    if (getAllowEnd()) {
      createWorld(
          WorldCreator.name(name + "_the_end")
              .environment(Environment.THE_END)
              .seed(seed)
              .type(type)
              .generateStructures(structs));
    }

    // Finish loading plugins
    enablePlugins(PluginLoadOrder.POSTWORLD);
    commandMap.registerServerAliases();
    scheduler.start();
  }
Beispiel #17
0
	@Override
	public World createWorld(WorldCreator creator) {
		if (creator == null) {
			throw new IllegalArgumentException("Creator may not be null");
		}

		String name = creator.name();
		ChunkGenerator generator = creator.generator();
		File folder = new File(getWorldContainer().getParentFile(), name);
		int dimension = DimensionManager.getNextFreeDimId();
		World world = getWorld(dimension);
		WorldType type = WorldType.parseWorldType(creator.type().getName());
		boolean generateStructures = creator.generateStructures();

		if (world != null) {
			return world;
		}

		if ((folder.exists()) && (!folder.isDirectory())) {
			throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
		}

		if (generator == null) {
			generator = getGenerator(dimension);
		}

		AnvilSaveConverter converter = new AnvilSaveConverter(getWorldContainer());
		if (converter.isOldMapFormat(name)) {
			getLogger().info("Converting world '" + name + "'");
			converter.convertMapFormat(name, new ConvertingProgressUpdate(theServer));
		}


		boolean hardcore = false;

		WorldServer internal = new WorldServer(theServer, new AnvilSaveHandler(getWorldContainer().getParentFile(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGameType.getByID(getDefaultGameMode().getValue()), generateStructures, hardcore, type), theServer.theProfiler);

		if (!(worlds.containsKey(dimension))) {
			return null;
		}

		//internal.getWorldInfo().get = console.worldServerForDimension(0).worldMaps;

		//internal. = new EntityTracker(internal); // CraftBukkit
		internal.addWorldAccess((IWorldAccess) new WorldManager(theServer, internal));
		internal.difficultySetting = 1;
		//internal.(true, true);
		//theServer.worldServers[theServer.worldServers.length] = internal;
		DimensionManager.setWorld(dimension, internal);
		this.worlds.put(dimension, new BukkitWorld(internal, creator.generator(), creator.environment()));
		if (generator != null) {
			(worlds.get(dimension)).getPopulators().addAll(generator.getDefaultPopulators(worlds.get(dimension)));
		}

		pluginManager.callEvent(new WorldInitEvent((worlds.get(dimension))));
		System.out.print("Preparing start region for level " + (theServer.worldServers.length - 1) + " (Seed: " + internal.getSeed() + ")");

		if (DimensionManager.shouldLoadSpawn(dimension)) {
			short short1 = 196;
			long i = System.currentTimeMillis();
			for (int j = -short1; j <= short1; j += 16) {
				for (int k = -short1; k <= short1; k += 16) {
					long l = System.currentTimeMillis();

					if (l < i) {
						i = l;
					}

					if (l > i + 1000L) {
						int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
						int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;

						System.out.println("Preparing spawn area for " + name + ", " + (j1 * 100 / i1) + "%");
								i = l;
					}

					ChunkCoordinates chunkcoordinates = internal.getSpawnPoint();
					internal.theChunkProviderServer.provideChunk(chunkcoordinates.posX + j >> 4, chunkcoordinates.posZ + k >> 4);

					//while (internal.updateLights()) {
					//  ;
				}//
			}
		}
		pluginManager.callEvent( new WorldLoadEvent(worlds.get(dimension)));
		return worlds.get(dimension);
	}
Beispiel #18
0
 /**
  * Creates or loads a world with the given name. If the world is already loaded, it will just
  * return the equivalent of getWorld(name)
  *
  * @param name Name of the world to load
  * @param environment Environment type of the world
  * @param seed Seed value to create the world with
  * @param generator ChunkGenerator to use in the construction of the new world
  * @return Newly created or loaded World
  */
 @Deprecated
 public GlowWorld createWorld(
     String name, Environment environment, long seed, ChunkGenerator generator) {
   return createWorld(
       WorldCreator.name(name).environment(environment).seed(seed).generator(generator));
 }
Beispiel #19
0
 /**
  * Creates or loads a world with the given name. If the world is already loaded, it will just
  * return the equivalent of getWorld(name)
  *
  * @param name Name of the world to load
  * @param environment Environment type of the world
  * @param seed Seed value to create the world with
  * @return Newly created or loaded World
  */
 @Deprecated
 public GlowWorld createWorld(String name, Environment environment, long seed) {
   return createWorld(WorldCreator.name(name).environment(environment).seed(seed));
 }
Beispiel #20
0
 public static World createWorld(String worldname, long seed) {
   String gen = getGeneratorPlugin(worldname);
   if (gen == null) {
     MyWorlds.log(Level.INFO, "Loading or creating world: '" + worldname + "' using seed " + seed);
   } else {
     MyWorlds.log(
         Level.INFO,
         "Loading or creating world: '"
             + worldname
             + "' using seed "
             + seed
             + " and chunk generator: '"
             + gen
             + "'");
   }
   final int retrycount = 3;
   World w = null;
   int i = 0;
   ChunkGenerator cgen = null;
   try {
     if (gen != null) {
       cgen = getGenerator(worldname, gen);
     }
   } catch (Exception ex) {
   }
   if (gen != null && cgen == null) {
     MyWorlds.log(
         Level.SEVERE,
         "World '"
             + worldname
             + "' could not be loaded because the chunk generator '"
             + gen
             + "' was not found!");
     return null;
   }
   WorldConfig wc = WorldConfig.get(worldname);
   wc.chunkGeneratorName = gen;
   for (i = 0; i < retrycount + 1; i++) {
     try {
       WorldCreator c = new WorldCreator(worldname);
       c.environment(wc.environment);
       c.seed(seed);
       c.generator(cgen);
       w = c.createWorld();
     } catch (Exception ex) {
       MyWorlds.log(Level.WARNING, "World load issue: " + ex.getMessage());
     }
     if (w != null) break;
   }
   if (w != null) {
     wc.updatePVP(w);
     // Data file is made?
     if (!worldExists(worldname)) {
       w.save();
     }
   }
   if (w == null) {
     MyWorlds.log(Level.WARNING, "Operation failed after " + i + " retries!");
   } else if (i == 1) {
     MyWorlds.log(Level.INFO, "Operation succeeded after 1 retry!");
   } else if (i > 0) {
     MyWorlds.log(Level.INFO, "Operation succeeded after " + i + " retries!");
   }
   return w;
 }
Beispiel #21
0
  @Override
  public World createWorld(WorldCreator creator) {
    if (creator == null) {
      throw new IllegalArgumentException("Creator may not be null");
    }

    String name = creator.name();
    World world = getWorld(name);

    //		WorldType type = WorldType.parseWorldType(creator.type().getName());

    if (world != null) { // Existing forge world
      return world;
    }

    if (firstBukkitWorld) {
      DimensionManager.registerProviderType(
          CraftWorldProvider.ProviderID, CraftWorldProvider.class, false);
      firstBukkitWorld = false;
    }

    int dimension = -1000;

    if (CraftWorldProvider.hasDimensionIdForName(name)) {
      dimension = CraftWorldProvider.getDimensionIdForName(name);
    } else {
      dimension = DimensionManager.getNextFreeDimId();
      CraftWorldProvider.setDimensionIdForName(name, dimension);
    }

    DimensionManager.registerDimension(dimension, CraftWorldProvider.ProviderID);

    CraftWorldProvider wp = (CraftWorldProvider) DimensionManager.createProviderFor(dimension);
    wp.setName(creator.name());

    File folder = new File(getWorldContainer(), wp.getDimName());
    if ((folder.exists()) && (!folder.isDirectory())) {
      throw new IllegalArgumentException(
          "File exists with the name '" + name + "' and isn't a folder");
    }

    ChunkGenerator generator = creator.generator();
    boolean generateStructures = creator.generateStructures();

    AnvilSaveConverter converter = new AnvilSaveConverter(folder);
    if (converter.isOldMapFormat(wp.getDimensionName())) {
      getLogger().info("Converting world '" + name + "'");
      converter.convertMapFormat(name, new ConvertingProgressUpdate(theServer));
    }

    WorldType type = WorldType.parseWorldType(creator.type().getName());

    // WorldServer internal = new WorldServer(theServer, new
    // AnvilSaveHandler(getWorldContainer().getParentFile(), name, true), name, dimension, new
    // WorldSettings(creator.seed(), EnumGameType.getByID(getDefaultGameMode().getValue()),
    // generateStructures, false, type), theServer.theProfiler);
    // WorldServerMulti internal = new WorldServerMulti(theServer, new
    // AnvilSaveHandler(getWorldContainer()                , name, true), name, dimension, new
    // WorldSettings(creator.seed(), EnumGameType.getByID(getDefaultGameMode().getValue()),
    // generateStructures, false,    type), theServer.theProfiler, creator.environment(),
    // generator);
    WorldServer internal =
        new WorldServerMulti(
            theServer,
            new AnvilSaveHandler(getWorldContainer(), wp.getDimName(), true),
            name,
            dimension,
            new WorldSettings(
                creator.seed(),
                EnumGameType.getByID(getDefaultGameMode().getValue()),
                generateStructures,
                false,
                type),
            worlds.get(0).getHandle(),
            theServer.theProfiler);

    internal.addWorldAccess((IWorldAccess) new WorldManager(theServer, internal));
    internal.difficultySetting = 1;
    internal.provider = wp;

    wp.registerWorld(internal);

    // DimensionManager.setWorld(dimension, internal);  not necessary, done in constructor of
    // WorldServer
    worlds.cacheIfNotPresent(dimension);
    if (generator != null) {
      (worlds.get(dimension))
          .getPopulators()
          .addAll(generator.getDefaultPopulators(worlds.get(dimension)));
    }

    pluginManager.callEvent(new WorldInitEvent((worlds.get(dimension))));
    System.out.print(
        "Preparing start region for level "
            + (theServer.worldServers.length - 1)
            + " (Seed: "
            + internal.getSeed()
            + ")");

    if (DimensionManager.shouldLoadSpawn(dimension)) {
      short short1 = 196;
      long i = System.currentTimeMillis();
      for (int j = -short1; j <= short1; j += 16) {
        for (int k = -short1; k <= short1; k += 16) {
          long l = System.currentTimeMillis();

          if (l < i) {
            i = l;
          }

          if (l > i + 1000L) {
            int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
            int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;

            System.out.println("Preparing spawn area for " + name + ", " + (j1 * 100 / i1) + "%");
            i = l;
          }

          ChunkCoordinates chunkcoordinates = internal.getSpawnPoint();
          internal.theChunkProviderServer.provideChunk(
              chunkcoordinates.posX + j >> 4, chunkcoordinates.posZ + k >> 4);
        } //
      }
    }

    MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(internal));
    pluginManager.callEvent(new WorldLoadEvent(worlds.get(dimension)));
    return worlds.get(dimension);
  }