Skip to content

Commit

Permalink
Added MessagesFile
Browse files Browse the repository at this point in the history
  • Loading branch information
xDec0de committed Oct 28, 2024
1 parent c568b15 commit 4c52380
Showing 1 changed file with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package net.codersky.mcutils.storage.files.yaml;

import net.codersky.mcutils.Reloadable;
import net.codersky.mcutils.java.MCFiles;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.util.HashMap;

public class MessagesFile implements Reloadable {

protected final HashMap<String, Object> keys = new HashMap<>();
private final YamlManager manager;

public MessagesFile(String path) {
this.manager = new YamlManager(path);
}

/*
* File utils
*/

@NotNull
public File asFile() {
return manager.getFile();
}

public boolean exists() {
return manager.getFile().exists();
}

/*
* Reloadable implementation
*/

public boolean setup() {
return MCFiles.create(manager.getFile());
}

@Override
public boolean reload() {
return manager.reload(keys);
}

@Override
public boolean save() {
return manager.save(keys);
}
}

0 comments on commit 4c52380

Please sign in to comment.