Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Nov 8, 2023
1 parent c839e2e commit 54509b0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public void reload() {
Messages.getInstance().reload();
PlayerDeathMessages.getInstance().reload();
Settings.getInstance().reload();
UserData.getInstance().reload();
}

public String backup(boolean excludeUserData) {
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/dev/mrshawn/deathmessages/files/FileSettings.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dev.mrshawn.deathmessages.files;

import dev.mrshawn.deathmessages.DeathMessages;
import org.apache.logging.log4j.LogManager;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
Expand All @@ -13,20 +13,22 @@
import java.util.Map;

public class FileSettings<C extends Enum<C>> {
private final JavaPlugin plugin;
private final String fileName;
private final File file;
private YamlConfiguration yamlConfig;
private final Map<Enum<C>, Object> values = new HashMap<>();

public FileSettings(String fileName) {
public FileSettings(JavaPlugin plugin, String fileName) {
this.plugin = plugin;
this.fileName = fileName;
this.file = new File(DeathMessages.getInstance().getDataFolder(), fileName);
this.file = new File(plugin.getDataFolder(), fileName);
loadFile();
}

private void loadFile() {
if (!file.exists()) {
DeathMessages.getInstance().saveResource(fileName, false);
plugin.saveResource(fileName, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package dev.mrshawn.deathmessages.kotlin.files

import dev.mrshawn.deathmessages.DeathMessages
import dev.mrshawn.deathmessages.files.Config
import dev.mrshawn.deathmessages.files.FileSettings

object FileStore {
val CONFIG: FileSettings<Config> =
FileSettings<Config>("Settings.yml").loadSettings(Config::class.java)
FileSettings<Config>(DeathMessages.getInstance(), "Settings.yml").loadSettings(Config::class.java)
}

0 comments on commit 54509b0

Please sign in to comment.