mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2026-06-05 02:46:54 +00:00
removal of aero
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package me.totalfreedom.totalfreedommod.config;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public interface IConfig
|
||||
{
|
||||
void loadFrom(ConfigurationSection cs);
|
||||
void saveTo(ConfigurationSection cs);
|
||||
boolean isValid();
|
||||
}
|
||||
@@ -6,14 +6,14 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import net.pravian.aero.component.PluginComponent;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class MainConfig extends PluginComponent<TotalFreedomMod>
|
||||
public class MainConfig extends FreedomService
|
||||
{
|
||||
|
||||
public static final String CONFIG_FILENAME = "config.yml";
|
||||
@@ -22,10 +22,20 @@ public class MainConfig extends PluginComponent<TotalFreedomMod>
|
||||
private final ConfigDefaults defaults;
|
||||
public YamlConfiguration configuration;
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MainConfig(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
|
||||
entries = new EnumMap<>(ConfigEntry.class);
|
||||
|
||||
ConfigDefaults tempDefaults = null;
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
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 TotalFreedomMod plugin;
|
||||
private final File file;
|
||||
private final boolean copyDefaults;
|
||||
|
||||
public YamlConfig(TotalFreedomMod plugin, String name, boolean copyDefaults)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.file = new File(plugin.getDataFolder(), name);
|
||||
this.copyDefaults = copyDefaults;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user