-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
shared/src/main/java/net/codersky/mcutils/storage/files/yaml/MessagesFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |