Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public MySQLConnector mySQL;
- public MySqlManager mm;
- public File config = new File(getDataFolder() + "/config.yml");
- public YamlConfiguration cfg = YamlConfiguration.loadConfiguration(this.config);
- public static String user = null;
- public static String hostname = null;
- public static String password = null;
- public static Integer port = null;
- public static String database = null;
- onEnable(){
- this.mm = new MySqlManager();
- createConfig();
- this.mm.register();
- connect();
- }
- private void createConfig()
- {
- if (!this.config.exists()) {
- try
- {
- this.config.createNewFile();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- }
- public static Main getInstance()
- {
- return (Main)plugin;
- }
- @SuppressWarnings("static-access")
- private void connect()
- {
- this.mySQL = new MySQLConnector(this.user, this.password, this.hostname, this.database, this.port);
- this.mySQL.connect();
- if (this.mySQL.isConnected()) {
- this.mySQL.update("CREATE TABLE IF NOT EXISTS Stats(UUID varchar(64), NAME varchar(64), KILLS int, DEATHS int, POINTS int);");
- }
- }
- @SuppressWarnings("unused")
- private void disconnect()
- {
- this.mySQL.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement