88import java .io .File ;
99import java .io .IOException ;
1010
11- import static com .github .pinont .singularitylib .plugin .CorePlugin .getInstance ;
12-
1311/**
1412 * Manages configuration files for the plugin.
1513 * This class provides functionality to create, load, save, and manipulate YAML configuration files.
@@ -19,15 +17,16 @@ public class ConfigManager {
1917 private final File configFile ;
2018 private FileConfiguration config ;
2119 private final String fileName ;
22- private final Plugin plugin = getInstance () ;
20+ private final Plugin plugin ;
2321 private boolean isFirstLoad ;
2422
2523 /**
2624 * Creates a ConfigManager for a configuration file in the plugin's data folder.
2725 *
2826 * @param fileName the name of the configuration file
2927 */
30- public ConfigManager (String fileName ) {
28+ public ConfigManager (Plugin plugin , String fileName ) {
29+ this .plugin = plugin ;
3130 this .fileName = fileName ;
3231 configFile = new File (plugin .getDataFolder (), fileName );
3332 if (!configFile .exists ()) {
@@ -51,8 +50,8 @@ public ConfigManager(String fileName) {
5150 * @param fileName the name of the configuration file
5251 * @return true if the file exists, false otherwise
5352 */
54- public static boolean isExists (String subFolder , String fileName ) {
55- return new File (getInstance () .getDataFolder () + "/" + subFolder , fileName ).exists ();
53+ public static boolean isExists (Plugin plugin , String subFolder , String fileName ) {
54+ return new File (plugin .getDataFolder () + "/" + subFolder , fileName ).exists ();
5655 }
5756
5857 /**
@@ -61,7 +60,8 @@ public static boolean isExists(String subFolder, String fileName) {
6160 * @param subFolder the subfolder where the configuration file should be located
6261 * @param fileName the name of the configuration file
6362 */
64- public ConfigManager (String subFolder , String fileName ) {
63+ public ConfigManager (Plugin plugin , String subFolder , String fileName ) {
64+ this .plugin = plugin ;
6565 this .fileName = fileName ;
6666 configFile = new File (plugin .getDataFolder () + "/" + subFolder , fileName );
6767 if (!configFile .exists ()) {
0 commit comments