Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void connectMySQL(){
- try{
- File f = new File("plugins/BanSystem MySQL/MySQL/connectiondata.yml");
- Configuration connectiondata = ConfigurationProvider.getProvider(YamlConfiguration.class).load(f);
- if(connectiondata.get("host") == null){
- connectiondata.set("host" , "gnomehd.net");
- }
- if(connectiondata.get("database") == null){
- connectiondata.set("database" , "KartoffelServer");
- }
- if(connectiondata.get("user") == null){
- connectiondata.set("user" , "Kevin");
- }
- if(connectiondata.get("password") == null){
- connectiondata.set("password" , "Kevin123");
- }
- if(connectiondata.get("port") == null){
- connectiondata.set("port" , 3306);
- }
- ConfigurationProvider.getProvider(YamlConfiguration.class).save(connectiondata, f);
- String host = connectiondata.getString("host");
- String database = connectiondata.getString("database");
- String user = connectiondata.getString("user");
- String password = connectiondata.getString("password");
- int port = connectiondata.getInt("port");
- mysql = new SQLConnection(host ,port, database , user , password);
- mysql.update("CREATE TABLE IF NOT EXISTS LBSYSOP (UUID , varchar(64));");
- mysql.update("CREATE TABLE IF NOT EXISTS LBSYSOS (Name , TEXT);");
- }catch (IOException ex){
- ex.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement