Guest User

Untitled

a guest
Mar 26th, 2017
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. package de.slixfx.slixban.main;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5.  
  6. import de.slixfx.slixban.mysql.MySQL;
  7. import net.md_5.bungee.api.plugin.Plugin;
  8. import net.md_5.bungee.config.Configuration;
  9. import net.md_5.bungee.config.ConfigurationProvider;
  10. import net.md_5.bungee.config.YamlConfiguration;
  11.  
  12. public class Main extends Plugin {
  13.  
  14. public String prefix = "§8[§6Slix§3Ban§8] §r";
  15. public String noperm = prefix+"§cDazu hast Du keine Berechtigung";
  16.  
  17. public void onEnable() {
  18. instance = this;
  19. readMySQLFile();
  20. MySQL.connect();
  21. MySQL.createTables();
  22. }
  23.  
  24. public void onDisable() {
  25. MySQL.close();
  26. }
  27.  
  28. public static Main instance;
  29.  
  30. public static Main getInstance() {
  31. return instance;
  32. }
  33.  
  34. public void readMySQLFile() {
  35. File configFile = new File(this.getDataFolder(), "mysql.yml");
  36. try {
  37. Configuration cfg = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
  38. MySQL.username = cfg.getString("mysql.username");
  39. MySQL.password = cfg.getString("mysql.password");
  40. MySQL.database = cfg.getString("mysql.database");
  41. MySQL.host = cfg.getString("mysql.host");
  42. MySQL.port = cfg.getString("mysql.port");
  43. } catch (IOException e) {
  44. // TODO Auto-generated catch block
  45. e.printStackTrace();
  46. }
  47.  
  48. }
  49.  
  50. }
Add Comment
Please, Sign In to add comment