From 98bbc35c2f7883feb7525631dda8b12f77c0cd96 Mon Sep 17 00:00:00 2001 From: Lorenzo <69311874+Lorenzo0111@users.noreply.github.com> Date: Fri, 11 Feb 2022 19:59:51 +0100 Subject: [PATCH] Fixed database connection --- build.gradle | 2 +- src/main/java/me/lorenzo0111/multilang/MultiLangPlugin.java | 3 +-- .../me/lorenzo0111/multilang/database/DatabaseManager.java | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 2c1205a..092fea6 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ ext { } group = "me.lorenzo0111" -version = "1.7" +version = "1.7.1" description = "MultiLang is a library that allows you to easily create multi-language placeholders." java { diff --git a/src/main/java/me/lorenzo0111/multilang/MultiLangPlugin.java b/src/main/java/me/lorenzo0111/multilang/MultiLangPlugin.java index d0a445c..25c4f6a 100644 --- a/src/main/java/me/lorenzo0111/multilang/MultiLangPlugin.java +++ b/src/main/java/me/lorenzo0111/multilang/MultiLangPlugin.java @@ -54,7 +54,6 @@ import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitWorker; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -141,7 +140,7 @@ public void onEnable() { this.reloadRealtimeConfig(); if (translators.isUseCache()) { - translators.loadCache(databaseManager); + Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> translators.loadCache(databaseManager), 60 * 20L); } this.cacheFolder = new File(this.getDataFolder(), "cache"); diff --git a/src/main/java/me/lorenzo0111/multilang/database/DatabaseManager.java b/src/main/java/me/lorenzo0111/multilang/database/DatabaseManager.java index 0a74598..d72605c 100644 --- a/src/main/java/me/lorenzo0111/multilang/database/DatabaseManager.java +++ b/src/main/java/me/lorenzo0111/multilang/database/DatabaseManager.java @@ -83,6 +83,7 @@ public static IConnectionHandler createConnection(@NotNull MultiLangPlugin plugi case MYSQL: config.setPoolName("MultiLang MySQL Connection Pool"); config.setDriverClassName(driver.getName()); + config.setJdbcUrl("jdbc:mysql://" + plugin.getConfig("mysql.ip") + ":" + plugin.getConfig("mysql.port") + "/" + plugin.getConfig("mysql.database")); config.addDataSourceProperty("serverName", plugin.getConfig("mysql.ip")); config.addDataSourceProperty("port", plugin.getConfig("mysql.port")); config.addDataSourceProperty("databaseName", plugin.getConfig("mysql.database"));