44 lines
1.1 KiB
Java
44 lines
1.1 KiB
Java
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
|
|
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.security.PublicKey;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class ReportLogStorage {
|
|
public static List<String> list = new ArrayList<>();
|
|
|
|
protected static File config = new File("T2CodeReportKeys.yml");
|
|
protected static YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
|
|
|
public static void add(String key){
|
|
list.add(key);
|
|
save();
|
|
}
|
|
|
|
public static void remove(String key){
|
|
list.remove(key);
|
|
save();
|
|
}
|
|
|
|
public static void save(){
|
|
if (list.isEmpty()) return;
|
|
yamlConfiguration.set("Keys",list);
|
|
|
|
try {
|
|
yamlConfiguration.save(config);
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public static void load(){
|
|
if (!config.exists()) return;
|
|
list = yamlConfiguration.getStringList("Keys");
|
|
}
|
|
}
|