aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColourConfig.java
blob: c8c47d77e9b2ca88af4f7e0746e75d9da4de90f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package net.inyourwalls.customlevelcolour;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Path;

public class CustomLevelColourConfig {
    private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
    public int outlineColour = 0x000000;
    public int textColour = 0x80ff20;

    public static CustomLevelColourConfig load(Path path) throws IOException {
        FileReader reader = new FileReader(path.toFile());
        return GSON.fromJson(reader, CustomLevelColourConfig.class);
    }

    public static void save(CustomLevelColourConfig config, Path path) throws IOException {
        FileWriter writer = new FileWriter(path.toFile());
        GSON.toJson(config, writer);
        writer.close();
    }
}