Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Config extends YamlConfiguration {
- private MyPlugin plugin;
- private File file;
- public Config(MyPlugin plugin, String name) {
- this.plugin = plugin;
- this.file = new File(plugin.getDataFolder(), name);
- reloadFile();
- }
- public void reloadFile() {
- if (!file.exists()) {
- file.getParentFile().mkdirs();
- plugin.saveResource(name);
- }
- try {
- load(file);
- } catch (IOException | InvalidConfigurationException err) {
- err.printStackTrace();
- }
- }
- public void saveFile() {
- try {
- save(file);
- } catch (IOException err) {
- err.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment