forked from LogBlock/LogBlock
Fixed writelock issue.
This commit is contained in:
@@ -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 {
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user