Answers for "config file spigot"

1

spigot make config file

@Override
    public void onEnable() {
        createFiles();
    }

    private void createFiles(){
        File configf = new File(getDataFolder(), "config.yml");

        if(!configf.exists()){
            configf.getParentFile().mkdirs();
            saveResource("config.yml", false);
        }
        FileConfiguration config = new YamlConfiguration();

        try{
            config.load(configf);
        }catch (IOException | InvalidConfigurationException e){
            e.printStackTrace();
        }
    }
Posted by: Guest on February-26-2021
1

spigot make config file

public private File configf;
    public FileConfiguration config;

    private void createFiles(){
        configf = new File(getDataFolder(), "config.yml");

        if(!configf.exists()){
            configf.getParentFile().mkdirs();
            saveResource("config.yml", false);
        }
        config = new YamlConfiguration();

        try{
            config.load(configf);
        }catch (IOException | InvalidConfigurationException e){
            e.printStackTrace();
        }
    }
Posted by: Guest on February-26-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language