Advertisement
Guest User

Untitled

a guest
Apr 11th, 2021
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. public static Main instance;
  2. public static MySQL mysql;
  3. public TutorialCountdown tutorialCountdown = new TutorialCountdown();
  4.  
  5. @Override
  6. public void onEnable() {
  7. instance = this;
  8. this.reloadConfig();
  9. this.getConfig().options().header("MySQL Settings -> CBSystem");
  10. this.getConfig().addDefault("MySQL.host" , "localhost");
  11. this.getConfig().addDefault("MySQL.database" , "CityBuild");
  12. this.getConfig().addDefault("MySQL.user" , "CityBuild");
  13. this.getConfig().addDefault("MySQL.password" , "4hZbzgGEWEaqqbR6");
  14.  
  15.  
  16. this.getConfig().options().copyDefaults(true);
  17. this.saveConfig();
  18. Bukkit.getConsoleSender().sendMessage("§aCBSystem start!");
  19. init(Bukkit.getPluginManager());
  20. ConnectMysql();
  21. this.getCommand("pay").setExecutor(new PayCommand(this));
  22. }
  23. private void init(PluginManager pm){
  24. pm.registerEvents(new JoinListener(), this);
  25.  
  26. }
  27. private void ConnectMysql() {
  28. mysql = new MySQL(this.getConfig().getString("MySQL.host") , this.getConfig().getString("MySQL.database"), this.getConfig().getString("MySQL.user") , this.getConfig().getString("MySQL.password"));
  29. mysql.update("CREATE TABLE IF NOT EXISTS CB(UUID varchar(64));");
  30. mysql.update("CREATE TABLE IF NOT EXISTS Coins(UUID varchar(64), COINS int);");
  31.  
  32. }
  33.  
  34. @Override
  35. public void onDisable() {
  36. Bukkit.getConsoleSender().sendMessage("§c CBSystem Stop!");
  37. mysql.close();
  38. }
  39.  
  40. public static Main getInstance() {
  41. return instance;
  42. }
  43.  
  44. public TutorialCountdown getTutorialCountdown() {
  45. return tutorialCountdown;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement