Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. public MySQLConnector mySQL;
  2. public MySqlManager mm;
  3.  
  4. public File config = new File(getDataFolder() + "/config.yml");
  5. public YamlConfiguration cfg = YamlConfiguration.loadConfiguration(this.config);
  6. public static String user = null;
  7. public static String hostname = null;
  8. public static String password = null;
  9. public static Integer port = null;
  10. public static String database = null;
  11.  
  12. onEnable(){
  13.  
  14. this.mm = new MySqlManager();
  15. createConfig();
  16. this.mm.register();
  17.  
  18. connect();
  19. }
  20.  
  21. private void createConfig()
  22. {
  23. if (!this.config.exists()) {
  24. try
  25. {
  26. this.config.createNewFile();
  27. }
  28. catch (IOException e)
  29. {
  30. e.printStackTrace();
  31. }
  32. }
  33. }
  34.  
  35.  
  36.  
  37. public static Main getInstance()
  38. {
  39. return (Main)plugin;
  40. }
  41.  
  42. @SuppressWarnings("static-access")
  43. private void connect()
  44. {
  45. this.mySQL = new MySQLConnector(this.user, this.password, this.hostname, this.database, this.port);
  46. this.mySQL.connect();
  47. if (this.mySQL.isConnected()) {
  48. this.mySQL.update("CREATE TABLE IF NOT EXISTS Stats(UUID varchar(64), NAME varchar(64), KILLS int, DEATHS int, POINTS int);");
  49. }
  50. }
  51.  
  52. @SuppressWarnings("unused")
  53. private void disconnect()
  54. {
  55. this.mySQL.close();
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement