diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java index 6c7af04e3..6338bee7f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java @@ -60,6 +60,12 @@ public class MySQL extends Database { this.connection = null; } + public Connection forceConnection() throws SQLException, ClassNotFoundException { + Class.forName("com.mysql.jdbc.Driver"); + this.connection = DriverManager.getConnection("jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.database, this.user, this.password); + return this.connection; + } + @Override public Connection openConnection() throws SQLException, ClassNotFoundException { if (checkConnection()) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 432616194..8630bab4e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -86,13 +86,13 @@ public class SQLManager implements AbstractDB { Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable(){ public void run(){ try { - connection = PlotMain.getMySQL().openConnection(); + connection = PlotMain.getMySQL().forceConnection(); } catch (Exception e) { e.printStackTrace(); } } - }, 500000, 500000); + }, 11000, 11000); }