4
0
Fork 0
mirror of https://github.com/Anvilcraft/modpacktools synced 2024-11-17 23:41:55 +01:00

small cleanup

This commit is contained in:
LordMZTE 2020-07-26 20:32:02 +02:00
parent 9aea30e441
commit b427ff532b

View file

@ -6,16 +6,14 @@ import java.io.File
import java.io.FileReader
class ModpackJsonHandler(val modpackJsonFile: File) {
var asWrapper: ASWrapper? = null
private set
get() = field ?: run {
if(modpackJsonFile.exists()) {
val reader = FileReader(modpackJsonFile)
field = ASWrapper(AddonscriptJSON.read(reader, AddonscriptJSON::class.java))
reader.close()
}
field
}
val asWrapper: ASWrapper? by lazy {
if(modpackJsonFile.exists()) {
val reader = FileReader(modpackJsonFile)
val ret = ASWrapper(AddonscriptJSON.read(reader, AddonscriptJSON::class.java))
reader.close()
ret
} else null
}
val json: AddonscriptJSON?
get() = asWrapper?.json