diff --git a/src/de/diddiz/LogBlock/LBPlayerListener.java b/src/de/diddiz/LogBlock/LBPlayerListener.java index 5eaa99d..70d9a93 100644 --- a/src/de/diddiz/LogBlock/LBPlayerListener.java +++ b/src/de/diddiz/LogBlock/LBPlayerListener.java @@ -53,8 +53,10 @@ public class LBPlayerListener extends PlayerListener return; Statement state = null; try { + conn.setAutoCommit(false); state = conn.createStatement(); state.execute("INSERT IGNORE INTO `lb-players` (playername) VALUES ('" + event.getPlayer().getName() + "');"); + conn.commit(); } catch (final SQLException ex) { log.log(Level.SEVERE, "[LogBlock] SQL exception", ex); } finally { diff --git a/src/de/diddiz/util/ConnectionPool.java b/src/de/diddiz/util/ConnectionPool.java index d576d10..e0e2ed4 100644 --- a/src/de/diddiz/util/ConnectionPool.java +++ b/src/de/diddiz/util/ConnectionPool.java @@ -136,6 +136,13 @@ public class ConnectionPool { @Override public void close() { inuse = false; + try { + if (!conn.getAutoCommit()) + conn.setAutoCommit(true); + } catch (SQLException ex) { + removeConnection(this); + terminate(); + } } @Override