From 8e6608d613ee4c74c8b278b947bb3a2035868649 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 14 Dec 2014 12:12:21 +1100 Subject: [PATCH] WE SERIOUSLY NEED TO FIX THIS ISSUE AT SOME POINT (THIS IS NOT THE OFFICIAL FIX, JUST A TEMPORARY THING) --- .../plot/database/SQLManager.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) 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 177d188b9..b7544c24b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -66,6 +66,8 @@ public class SQLManager implements AbstractDB { // Private final connection = c; prefix = p; + // Set timout + setTimout(); // Public final SET_OWNER = "UPDATE `" + prefix + "plot` SET `owner` = ? WHERE `plot_id_x` = ? AND `plot_id_z` = ?"; @@ -81,6 +83,22 @@ public class SQLManager implements AbstractDB { "INSERT INTO `" + prefix + "plot`(`plot_id_x`, `plot_id_z`, `owner`, `world`) VALUES(?, ?, ?, ?)"; } + public void setTimout() { + runTask(new Runnable() { + @Override + public void run() { + try { + final PreparedStatement statement = connection.prepareStatement("SET GLOBAL wait_timeout =28800;"); + statement.executeUpdate(); + statement.close(); + } catch (final SQLException e) { + e.printStackTrace(); + Logger.add(LogLevel.DANGER, "Could not reset MySQL timout."); + } + } + }); + } + /** * Set Plot owner * @@ -265,6 +283,10 @@ public class SQLManager implements AbstractDB { */ @Override public void createTables(final String database, final boolean add_constraint) throws SQLException { + + + + final boolean mysql = database.equals("mysql"); final Statement stmt = connection.createStatement(); if (mysql) {