Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FileManager {
- private File config;
- private YamlConfiguration yml;
- private String name;
- public FileManager(String path, String name) {
- File file = new File(path);
- if(!file.exists()) {
- file.mkdir();
- }
- this.config= new File(path + "/" + name + ".yml");
- this.name=name;
- }
- public void create() {
- if(!this.config.exists()) {
- try {
- this.config.createNewFile();
- }
- catch (IOException e) {}
- }
- }
- public void save() {
- try {
- yml.save(config);
- }
- catch (IOException ioe) {}
- }
- public File getFile() {
- return config;
- }
- public void set(String path, Object obj) {
- yml.set(path, obj);
- save();
- }
- public void load() {
- this.yml=YamlConfiguration.loadConfiguration(this.config);
- }
- public void delete(){
- this.config.delete();
- }
- public YamlConfiguration getYml() {
- return this.yml;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement