TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/config/YamlConfig.java
Paldiu 5c0f77c7c5 Removal of Lombok
Lombok implementation removal.

I have also gone through and replaced things with inline methods and variables, lambdas, and simplified loops down, removed unnecessary guard clauses, and overall cleaned up every single class. This took a long time, please do remember to follow proper naming conventions, don't include unnecessary guard clauses, follow exception rules and comment rules, and please PLEASE remember to use the DIAMOND OPERATOR rather than just inferring RAW TYPES!!!

Thank you!!
2020-12-25 14:46:43 -05:00

64 lines
1.2 KiB
Java

package me.totalfreedom.totalfreedommod.config;
import java.io.File;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import org.bukkit.configuration.file.YamlConfiguration;
public class YamlConfig extends YamlConfiguration
{
private final File file;
public YamlConfig(TotalFreedomMod plugin, String name, boolean copyDefaults)
{
this.file = new File(plugin.getDataFolder(), name);
if (copyDefaults)
{
options().copyDefaults(true);
}
if (!file.exists())
{
plugin.saveResource(name, false);
}
load();
}
public YamlConfig(TotalFreedomMod plugin, String name)
{
this(plugin, name, true);
}
public void load()
{
try
{
super.load(file);
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void save()
{
try
{
super.save(file);
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void clear()
{
for (String key : super.getKeys(false))
{
super.set(key, null);
}
}
}