All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.krrrr38.jabot.config.CommandConfig Maven / Gradle / Ivy

There is a newer version: 0.2.0
Show newest version
package com.krrrr38.jabot.config;

import org.kohsuke.args4j.Option;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class CommandConfig {
    @Option(name = "-c", usage = "path to plugins.yml")
    private File pluginConfig = new File("./plugins.yml");

    /**
     * read yaml to jabotConfig
     *
     * @return jabot config
     */
    public JabotConfig tojabotConfig() {
        try (InputStream input = new FileInputStream(pluginConfig)) {
            Yaml yaml = new Yaml(new Constructor(JabotConfig.class));
            return (JabotConfig) yaml.load(input);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy