mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-01 15:46:42 +00:00
tttt
This commit is contained in:
53
src/main/java/dev/plex/config/Config.java
Normal file
53
src/main/java/dev/plex/config/Config.java
Normal file
@ -0,0 +1,53 @@
|
||||
package dev.plex.config;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import java.io.File;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class Config extends YamlConfiguration
|
||||
{
|
||||
private Plex plugin;
|
||||
private File file;
|
||||
private String name;
|
||||
|
||||
public Config(Plex plugin, String name)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.file = new File(plugin.getDataFolder(), name);
|
||||
this.name = name;
|
||||
|
||||
if (!file.exists())
|
||||
{
|
||||
saveDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
try
|
||||
{
|
||||
super.load(file);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
try
|
||||
{
|
||||
super.save(file);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void saveDefault()
|
||||
{
|
||||
plugin.saveResource(name, false);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user