1 @Override
2 public void onEnable() {
3 createFiles();
4 }
5
6 private void createFiles(){
7 File configf = new File(getDataFolder(), "config.yml");
8
9 if(!configf.exists()){
10 configf.getParentFile().mkdirs();
11 saveResource("config.yml", false);
12 }
13 FileConfiguration config = new YamlConfiguration();
14
15 try{
16 config.load(configf);
17 }catch (IOException | InvalidConfigurationException e){
18 e.printStackTrace();
19 }
20 }
1 public private File configf;
2 public FileConfiguration config;
3
4 private void createFiles(){
5 configf = new File(getDataFolder(), "config.yml");
6
7 if(!configf.exists()){
8 configf.getParentFile().mkdirs();
9 saveResource("config.yml", false);
10 }
11 config = new YamlConfiguration();
12
13 try{
14 config.load(configf);
15 }catch (IOException | InvalidConfigurationException e){
16 e.printStackTrace();
17 }
18 }