Package net.ftb.data

Examples of net.ftb.data.Map


            }
        });
    }

    public static void cleanUp () {
        Map map = Map.getMap(LaunchFrame.getSelectedMapIndex());
        File tempFolder = new File(OSUtils.getCacheStorageLocation(), MAPS.replace("/", sep) + map.getMapName() + sep);
        for (String file : tempFolder.list()) {
            if (!file.equals(map.getLogoName()) && !file.equals(map.getImageName()) && !file.equalsIgnoreCase("version")) {
                try {
                    FTBFileUtils.delete(new File(tempFolder, file));
                } catch (IOException e) {
                    Logger.logError(e.getMessage(), e);
                }
View Full Code Here


            }
            NodeList maps = doc.getElementsByTagName("map");
            for (int i = 0; i < maps.getLength(); i++) {
                Node map = maps.item(i);
                NamedNodeMap mapAttr = map.getAttributes();
                Map.addMap(new Map(mapAttr.getNamedItem("name").getTextContent(), mapAttr.getNamedItem("author").getTextContent(), mapAttr.getNamedItem("version").getTextContent(), mapAttr
                        .getNamedItem("url").getTextContent(), mapAttr.getNamedItem("logo").getTextContent(), mapAttr.getNamedItem("image").getTextContent(), mapAttr.getNamedItem("compatible")
                        .getTextContent(), mapAttr.getNamedItem("mcversion").getTextContent(), mapAttr.getNamedItem("mapname").getTextContent(),
                        mapAttr.getNamedItem("description") == null ? null : mapAttr.getNamedItem("description").getTextContent().replace("\\n", "\n"),
                        i));
            }
View Full Code Here

        mapsScroll.revalidate();
    }

    @Override
    public void onMapAdded (Map map) {
        final Map map_ = map;
        SwingUtilities.invokeLater(new Runnable() {
            public void run () {
                addMap(map_);
                Logger.logInfo("Adding map " + getMapNum() + " (" + map_.getName() + ")");
                updateMaps();
            }
        });
    }
View Full Code Here

    }

    @Override
    protected Boolean doInBackground () throws Exception {
        String installPath = Settings.getSettings().getInstallPath();
        Map map = Map.getSelectedMap();
        if (new File(installPath, map.getSelectedCompatible() + "/minecraft/saves/" + map.getMapName()).exists()) {
            MapOverwriteDialog dialog = new MapOverwriteDialog();
            dialog.setVisible(true);
            if (overwrite) {
                FTBFileUtils.delete(new File(installPath, map.getSelectedCompatible() + "/minecraft/saves/" + map.getMapName()));
            } else {
                Logger.logInfo("Canceled map installation.");
                return false;
            }
        }
        downloadMap(map.getUrl(), map.getMapName());
        return false;
    }
View Full Code Here

    }

    protected void downloadMap (String mapName, String dir) throws IOException, NoSuchAlgorithmException {
        Logger.logInfo("Downloading Map");
        String installPath = OSUtils.getCacheStorageLocation();
        Map map = Map.getSelectedMap();
        new File(installPath + "/" + MAPS + dir + "/").mkdirs();
        new File(installPath + "/" + MAPS + dir + "/" + mapName).createNewFile();
        downloadUrl(installPath + "/" + MAPS + dir + "/" + mapName, DownloadUtils.getCreeperhostLink(MAPS + dir + "/" + map.getVersion().replace(".", "_") + "/" + mapName));
        FTBFileUtils.extractZipTo(installPath + "/" + MAPS + dir + "/" + mapName, installPath + "/" + MAPS + dir);
        installMap(mapName, dir);
    }
View Full Code Here

    protected void installMap (String mapName, String dir) throws IOException {
        Logger.logInfo("Installing Map");
        String installPath = Settings.getSettings().getInstallPath();
        String tempPath = OSUtils.getCacheStorageLocation();
        Map map = Map.getSelectedMap();
        new File(installPath, map.getSelectedCompatible() + "/minecraft/saves/" + dir).mkdirs();
        FTBFileUtils.copyFolder(new File(tempPath, MAPS + dir + "/" + dir), new File(installPath, map.getSelectedCompatible() + "/minecraft/saves/" + dir));
        FTBFileUtils.copyFile(new File(tempPath, MAPS + dir + "/" + "version"), new File(installPath, map.getSelectedCompatible() + "/minecraft/saves/" + dir + "/version"));
        TrackerUtils.sendPageView(map.getName() + " Install", "Maps / " + map.getName());
    }
View Full Code Here

TOP

Related Classes of net.ftb.data.Map

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.