diff --git a/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java b/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java index 3413aa51b..88d3686bf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java @@ -161,6 +161,16 @@ public abstract class RepositoryBase implements Listener e.printStackTrace(); } } + + try + { + if (DataSource != null) + _connection.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } } return affectedRows; @@ -203,6 +213,16 @@ public abstract class RepositoryBase implements Listener e.printStackTrace(); } } + + try + { + if (DataSource != null) + _connection.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } } } @@ -240,6 +260,16 @@ public abstract class RepositoryBase implements Listener e.printStackTrace(); } } + + try + { + if (DataSource != null) + _connection.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } } } @@ -314,7 +344,7 @@ public abstract class RepositoryBase implements Listener @EventHandler public void validateConnection(UpdateEvent event) { - if (event.getType() != UpdateType.MIN_02) + if (event.getType() != UpdateType.MIN_02 || DataSource != null) return; Bukkit.getScheduler().runTaskAsynchronously(Plugin, new Runnable()