Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void connectMySQL() {
- File file = new File("plugins//Lobby-System//mysql.yml");
- File ordner = new File("plugins//Lobby-System");
- if (!file.exists()) {
- try {
- file.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- if (!ordner.exists()) {
- ordner.mkdirs();
- }
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- cfg.options().header("Eine MySQL Datenbank ist erforderlich");
- cfg.addDefault("host", "localhost");
- cfg.addDefault("database", "lobby");
- cfg.addDefault("user", "admin");
- cfg.addDefault("password", "lobbymaster56");
- MySQL.HOST = cfg.getString("host");
- MySQL.DATABASE = cfg.getString("database");
- MySQL.USER = cfg.getString("user");
- MySQL.PASSWORD = cfg.getString("password");
- cfg.options().copyDefaults(true);
- try
- {
- cfg.save(file);
- } catch (IOException e) {
- e.printStackTrace();
- }
- mysql = new MySQL(MySQL.HOST, MySQL.DATABASE, MySQL.USER, MySQL.PASSWORD);
- mysql.update("CREATE TABLE IF NOT EXISTS gadgets(UUID varchar(64), ENDERPERLE int, Enterhaken int);");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement