Skip to content

Commit

Permalink
update file enum
Browse files Browse the repository at this point in the history
  • Loading branch information
ryderbelserion committed Jul 11, 2024
1 parent ed542e6 commit 09cab56
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/main/java/com/badbones69/crazycrates/api/enums/Files.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.badbones69.crazycrates.api.enums;

import com.badbones69.crazycrates.CrazyCrates;
import com.ryderbelserion.vital.paper.files.config.FileManager;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;

public enum Files {

Expand All @@ -11,9 +13,10 @@ public enum Files {

private final String fileName;
private final String strippedName;
private final YamlConfiguration configuration;

private final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);

private @NotNull final FileManager fileManager = this.plugin.getFileManager();

/**
* A constructor to build a file
Expand All @@ -23,22 +26,25 @@ public enum Files {
Files(final String fileName) {
this.fileName = fileName;
this.strippedName = this.fileName.replace(".yml", "");
this.configuration = this.plugin.getFileManager().getFile(this.fileName);
}

public final String getFileName() {
return this.fileName;
public final YamlConfiguration getConfiguration() {
return this.fileManager.getFile(this.fileName);
}

public final String getStrippedName() {
return this.strippedName;
}

public final YamlConfiguration getConfiguration() {
return this.configuration;
public final String getFileName() {
return this.fileName;
}

public void save() {
this.plugin.getFileManager().saveFile(this.fileName);
this.fileManager.saveFile(this.fileName);
}

public void reload() {
this.fileManager.reloadFile(this.fileName);
}
}

0 comments on commit 09cab56

Please sign in to comment.