Guest User

Config

a guest
Nov 18th, 2016
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. public static void setStandartMySQL() {
  2. FileConfiguration cfg = getMySQLFileConfiguration();
  3. cfg.options().copyDefaults(true);
  4. cfg.addDefault("username", "root");
  5. cfg.addDefault("password", "password");
  6. cfg.addDefault("database", "localhost");
  7. cfg.addDefault("host", "localhost");
  8. cfg.addDefault("port", "3306");
  9.  
  10. try {
  11. cfg.save(getMySQLFile());
  12. } catch (IOException e) {
  13.  
  14. e.printStackTrace();
  15. }
  16. }
  17.  
  18. public static void readMySQL() {
  19. FileConfiguration cfg = getMySQLFileConfiguration();
  20. MySQL.username = cfg.getString("username");
  21. MySQL.password = cfg.getString("password");
  22. MySQL.database = cfg.getString("database");
  23. MySQL.host = cfg.getString("host");
  24. MySQL.port = cfg.getString("port");
  25.  
  26. }
Add Comment
Please, Sign In to add comment