protected void a(String s, String s1, long i, WorldType worldtype, String s2) { this.a(s); this.b("menu.loadingLevel"); this.worldServer = new WorldServer[3]; /* CraftBukkit start - Remove ticktime arrays and worldsettings this.h = new long[this.worldServer.length][100]; IDataManager idatamanager = this.convertable.a(s, true); this.a(this.T(), idatamanager); WorldData worlddata = idatamanager.getWorldData(); WorldSettings worldsettings; if (worlddata == null) { if (this.W()) { worldsettings = DemoWorldServer.a; } else { worldsettings = new WorldSettings(i, this.getGamemode(), this.getGenerateStructures(), this.isHardcore(), worldtype); worldsettings.setGeneratorSettings(s2); if (this.M) { worldsettings.a(); } } worlddata = new WorldData(worldsettings, s1); } else { worlddata.a(s1); worldsettings = new WorldSettings(worlddata); } */ int worldCount = 3; for (int j = 0; j < worldCount; ++j) { WorldServer world; byte dimension = 0; if (j == 1) { if (getAllowNether()) { dimension = -1; } else { continue; } } if (j == 2) { if (server.getAllowEnd()) { dimension = 1; } else { continue; } } String worldType = org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase(); String name = (dimension == 0) ? s : s + "_" + worldType; org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name); WorldSettings worldsettings = new WorldSettings( i, this.getGamemode(), this.getGenerateStructures(), this.isHardcore(), worldtype); worldsettings.setGeneratorSettings(s2); if (j == 0) { IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), s1, true); WorldData worlddata = idatamanager.getWorldData(); if (worlddata == null) { worlddata = new WorldData(worldsettings, s1); } worlddata.checkName( s1); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take // the last loaded world as respawn (in this case the end) if (this.W()) { world = (WorldServer) (new DemoWorldServer( this, idatamanager, worlddata, dimension, this.methodProfiler)) .b(); } else { world = (WorldServer) (new WorldServer( this, idatamanager, worlddata, dimension, this.methodProfiler, org.bukkit.World.Environment.getEnvironment(dimension), gen)) .b(); } world.a(worldsettings); this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager( this, world.getScoreboard()); } else { String dim = "DIM" + dimension; File newWorld = new File(new File(name), dim); File oldWorld = new File(new File(s), dim); if ((!newWorld.isDirectory()) && (oldWorld.isDirectory())) { MinecraftServer.LOGGER.info( "---- Migration of old " + worldType + " folder required ----"); MinecraftServer.LOGGER.info( "Unfortunately due to the way that Minecraft implemented multiworld support in 1.6, Bukkit requires that you move your " + worldType + " folder to a new location in order to operate correctly."); MinecraftServer.LOGGER.info( "We will move this folder for you, but it will mean that you need to move it back should you wish to stop using Bukkit in the future."); MinecraftServer.LOGGER.info("Attempting to move " + oldWorld + " to " + newWorld + "..."); if (newWorld.exists()) { MinecraftServer.LOGGER.warn("A file or folder already exists at " + newWorld + "!"); MinecraftServer.LOGGER.info( "---- Migration of old " + worldType + " folder failed ----"); } else if (newWorld.getParentFile().mkdirs()) { if (oldWorld.renameTo(newWorld)) { MinecraftServer.LOGGER.info( "Success! To restore " + worldType + " in the future, simply move " + newWorld + " to " + oldWorld); // Migrate world data too. try { com.google.common.io.Files.copy( new File(new File(s), "level.dat"), new File(new File(name), "level.dat")); } catch (IOException exception) { MinecraftServer.LOGGER.warn("Unable to migrate world data."); } MinecraftServer.LOGGER.info( "---- Migration of old " + worldType + " folder complete ----"); } else { MinecraftServer.LOGGER.warn( "Could not move folder " + oldWorld + " to " + newWorld + "!"); MinecraftServer.LOGGER.info( "---- Migration of old " + worldType + " folder failed ----"); } } else { MinecraftServer.LOGGER.warn("Could not create path for " + newWorld + "!"); MinecraftServer.LOGGER.info( "---- Migration of old " + worldType + " folder failed ----"); } } IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), name, true); // world =, b0 to dimension, s1 to name, added Environment and gen WorldData worlddata = idatamanager.getWorldData(); if (worlddata == null) { worlddata = new WorldData(worldsettings, name); } worlddata.checkName( name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take // the last loaded world as respawn (in this case the end) world = (WorldServer) new SecondaryWorldServer( this, idatamanager, dimension, this.worlds.get(0), this.methodProfiler, worlddata, org.bukkit.World.Environment.getEnvironment(dimension), gen) .b(); } if (gen != null) { world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld())); } this.server .getPluginManager() .callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld())); world.addIWorldAccess(new WorldManager(this, world)); if (!this.S()) { world.getWorldData().setGameType(this.getGamemode()); } worlds.add(world); getPlayerList().setPlayerFileData(worlds.toArray(new WorldServer[worlds.size()])); } // CraftBukkit end this.a(this.getDifficulty()); this.k(); }