APISonar


org.jackhuang.hmcl.util.Logging.LOG.log

> org > jackhuang > hmcl > util > Logging > LOG > log
org APIs jackhuang APIs hmcl APIs util APIs Logging APIs LOG APIs log APIs

Example 1
public void run() {
        try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, Charset.defaultCharset()))) {
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                if (Thread.currentThread().isInterrupted()) {
                    Thread.currentThread().interrupt();
                    break;
                }

                callback.accept(line);
            }
        } catch (IOException e) {
            Logging.LOG.log(Level.SEVERE, "An error occurred when reading stream", e);
        }
    }
Example 2
public static void cleanVersion(Profile profile, String id) {
        try {
            profile.getRepository().clean(id);
        } catch (IOException e) {
            Logging.LOG.log(Level.WARNING, "Unable to clean game directory", e);
        }
    }
Example 3
private void installSingleDatapack(File datapack) {
        try {
            Datapack zip = new Datapack(datapack.toPath());
            zip.loadFromZip();
            zip.installTo(worldDir);
        } catch (IOException | IllegalArgumentException e) {
            Logging.LOG.log(Level.WARNING, "Unable to parse datapack file " + datapack, e);
        }
    }
Example 4
public boolean saveVersionSetting(String id) {
        if (!versionSettings.containsKey(id))
            return false;
        File file = getVersionSettingFile(id);
        if (!FileUtils.makeDirectory(file.getAbsoluteFile().getParentFile()))
            return false;

        try {
            FileUtils.writeText(file, GSON.toJson(versionSettings.get(id)));
            return true;
        } catch (IOException e) {
            Logging.LOG.log(Level.SEVERE, "Unable to save version setting of " + id, e);
            return false;
        }
    }
Example 5
protected void refreshVersionsImpl() {
        versionSettings.clear();
        super.refreshVersionsImpl();
        versions.keySet().forEach(this::loadVersionSetting);

        try {
            File file = new File(getBaseDirectory(), "launcher_profiles.json");
            if (!file.exists() && !versions.isEmpty())
                FileUtils.writeText(file, PROFILE);
        } catch (IOException ex) {
            Logging.LOG.log(Level.WARNING, "Unable to create launcher_profiles.json, Forge/LiteLoader installer will not work.", ex);
        }
    }
Example 6
public ServerModpackCompletionTask(DefaultDependencyManager dependencyManager, String version) {
        this.repository = dependencyManager.getGameRepository();
        this.version = version;

        try {
            File manifestFile = repository.getModpackConfiguration(version);
            if (manifestFile.exists())
                this.manifest = JsonUtils.GSON.fromJson(FileUtils.readText(manifestFile), new TypeToken<ModpackConfiguration<ServerModpackManifest>>() {
                }.getType());
        } catch (Exception e) {
            Logging.LOG.log(Level.WARNING, "Unable to read CurseForge modpack manifest.json", e);
        }
    }