Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void loadConfig() {
- file = new File(getDataFolder().getPath(), "config.yml");
- try {
- configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file);
- if(!getDataFolder().exists()) {
- getDataFolder().mkdir();
- }
- if(!file.exists()) {
- file.createNewFile();
- configuration.set("MySQL.Host", host);
- configuration.set("MySQL.username", username);
- configuration.set("MySQL.port", port);
- configuration.set("MySQL.password", password);
- configuration.set("MySQL.database", database);
- saveConfig();
- }
- } catch(IOException e) {
- e.printStackTrace();
- }
- if(file.exists()) {
- host = configuration.getString("MySQL.Host");
- username = configuration.getString("MySQL.username");
- port = configuration.getString("MySQL.port");
- password = configuration.getString("MySQL.password");
- database = configuration.getString("MySQL.database");
- MySQL sql = new MySQL(host, port, password, database, username);
- sql.connect();
- sql.createTable();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement