From 8938ad2456fc449f573096e8ad10ae6775fc93d4 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Fri, 14 Aug 2020 15:31:03 +0200 Subject: [PATCH] use readAsJson instead of JsonReader --- src/main/kotlin/ley/anvil/modpacktools/commands/Import.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/ley/anvil/modpacktools/commands/Import.kt b/src/main/kotlin/ley/anvil/modpacktools/commands/Import.kt index ec033d4..f1446b4 100644 --- a/src/main/kotlin/ley/anvil/modpacktools/commands/Import.kt +++ b/src/main/kotlin/ley/anvil/modpacktools/commands/Import.kt @@ -1,6 +1,5 @@ package ley.anvil.modpacktools.commands -import com.google.gson.stream.JsonReader import ley.anvil.addonscript.curse.ManifestJSON import ley.anvil.modpacktools.GSON import ley.anvil.modpacktools.MPJH @@ -9,12 +8,12 @@ import ley.anvil.modpacktools.command.CommandReturn.Companion.fail import ley.anvil.modpacktools.command.CommandReturn.Companion.success import ley.anvil.modpacktools.command.ICommand import ley.anvil.modpacktools.command.LoadCommand +import ley.anvil.modpacktools.util.readAsJson import net.sourceforge.argparse4j.ArgumentParsers import net.sourceforge.argparse4j.impl.type.FileArgumentType import net.sourceforge.argparse4j.inf.ArgumentParser import net.sourceforge.argparse4j.inf.Namespace import java.io.File -import java.io.FileReader import java.io.FileWriter @LoadCommand @@ -42,7 +41,7 @@ object Import : ICommand { println("Converting...") MPJH.modpackJsonFile.parentFile.mkdirs() val mpjWriter = FileWriter(MPJH.modpackJsonFile) - GSON.fromJson(JsonReader(FileReader(manifest)), ManifestJSON::class.java).toAS().write(mpjWriter) + GSON.fromJson(manifest.readAsJson(), ManifestJSON::class.java).toAS().write(mpjWriter) mpjWriter.close() return success("Converted sucessfully") }