0% found this document useful (0 votes)
11 views1 page

TimeFile Configuration Management

The TimeFile class manages a YAML configuration file named 'time-items.yml' for a Bukkit plugin. It includes methods to set up the file, load its contents, retrieve the configuration, and save changes. Error handling is implemented to catch issues during file loading and saving operations.

Uploaded by

spike.xxx1111
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

TimeFile Configuration Management

The TimeFile class manages a YAML configuration file named 'time-items.yml' for a Bukkit plugin. It includes methods to set up the file, load its contents, retrieve the configuration, and save changes. Error handling is implemented to catch issues during file loading and saving operations.

Uploaded by

spike.xxx1111
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

package [Link].

file;

import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

public class TimeFile {

private static File file;


private static FileConfiguration config;

public static void setup() {


file = new File([Link]().getDataFolder(), "[Link]");
if (![Link]()) {
[Link]().mkdirs();
[Link]().saveResource("[Link]", false);
}

config = new YamlConfiguration();


try {
[Link](file);
} catch (IOException |
[Link] e) {
[Link]();
}
}

public static FileConfiguration getConfig() {


return config;
}

public static void save() {


try {
[Link](file);
} catch (IOException e) {
[Link]("Nie mozna zapisac pliku!");
}
}

public static void loadFile() {


setup();
save();
}

You might also like