{
    net.minecraft.server.v1_9_R1.WorldServer[] defaultWorlds = (net.minecraft.server.v1_9_R1.WorldServer[]) com.grinderwolf.swm.clsm.ClassModifier.getDefaultWorlds();
    
    if (defaultWorlds != null) {
        System.out.println("Overriding default worlds");
        $0.a($1);
        $0.worldServer = new net.minecraft.server.v1_9_R1.WorldServer[3];
        
        for (int index = 0; index < 3; index++) {
            if (index == 1 && !getAllowNether()) {
                continue;
            }

            if (index == 2 && !server.getAllowEnd()) {
                continue;
            }

            net.minecraft.server.v1_9_R1.WorldServer world = defaultWorlds[index];
            byte dimension = (index == 1 ? -1 : (index == 2 ? 1 : 0));
            
            net.minecraft.server.v1_9_R1.WorldSettings worldSettings = new net.minecraft.server.v1_9_R1.WorldSettings($3, $0.getGamemode(), $0.getGenerateStructures(), $0.isHardcore(), $4);
            java.lang.String worldTypeString = org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase();
            java.lang.String name;
            
            if (dimension == 0) {
                name = $1;
            } else {
                name = $1 + "_" + worldTypeString;
            }
            
            if (world == null) {
                worldSettings.setGeneratorSettings($5);
            }
            
            if (index == 0) {
                if (world == null) {
                    net.minecraft.server.v1_9_R1.IDataManager nbtStorage = new net.minecraft.server.v1_9_R1.ServerNBTManager(server.getWorldContainer(), $2, true, $0.dataConverterManager);
                    net.minecraft.server.v1_9_R1.WorldData worldData = nbtStorage.getWorldData();
                    
                    if (worldData == null) {
                        worldData = new net.minecraft.server.v1_9_R1.WorldData(worldSettings, $2);
                    }
                    
                    worldData.checkName($2);
                    world = (net.minecraft.server.v1_9_R1.WorldServer) new net.minecraft.server.v1_9_R1.WorldServer($0, nbtStorage, worldData, dimension, $0.methodProfiler, org.bukkit.World.Environment.getEnvironment(dimension), $0.server.getGenerator(name)).b();
                    world.a(worldSettings);
                } else {
                    org.spigotmc.SpigotConfig.disableStatSaving = true;
                }
                
                $0.server.scoreboardManager = new org.bukkit.craftbukkit.v1_9_R1.scoreboard.CraftScoreboardManager($0, world.getScoreboard());
            } else if (world == null) {
                net.minecraft.server.v1_9_R1.IDataManager nbtStorage = new net.minecraft.server.v1_9_R1.ServerNBTManager(server.getWorldContainer(), name, true, $0.dataConverterManager);
                net.minecraft.server.v1_9_R1.WorldData worldData = nbtStorage.getWorldData();
                
                if (worldData == null) {
                    worldData = new net.minecraft.server.v1_9_R1.WorldData(worldSettings, name);
                }
                
                worldData.checkName(name);
                world = (net.minecraft.server.v1_9_R1.WorldServer) new net.minecraft.server.v1_9_R1.SecondaryWorldServer($0, nbtStorage, dimension, (net.minecraft.server.v1_9_R1.WorldServer) $0.worlds.get(0), $0.methodProfiler, worldData, org.bukkit.World.Environment.getEnvironment(dimension), $0.server.getGenerator(name)).b();
            }
            
            $0.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld()));
            
            if (defaultWorlds[index] == null) {
                world.addIWorldAccess(new net.minecraft.server.v1_9_R1.WorldManager($0, world));
            }
            
            if (!$0.R()) {
                world.getWorldData().setGameType($0.getGamemode());
            }
            
            $0.worlds.add(world);
            $0.getPlayerList().setPlayerFileData((net.minecraft.server.v1_9_R1.WorldServer[]) $0.worlds.toArray(new net.minecraft.server.v1_9_R1.WorldServer[$0.worlds.size()]));
        }
        
        $0.v.setPlayerFileData($0.worldServer);
        $0.a($0.getDifficulty());
        $0.l();
        
        return;
    }
}