commit
d78c84d8ce
|
|
@ -142,8 +142,8 @@ public class VanillaSync {
|
||||||
try {
|
try {
|
||||||
String player_uuid = event.getProfile().getId().toString();
|
String player_uuid = event.getProfile().getId().toString();
|
||||||
PlayerSync.LOGGER.info("Detected connection from player" + player_uuid + ",starting checking");
|
PlayerSync.LOGGER.info("Detected connection from player" + player_uuid + ",starting checking");
|
||||||
boolean online = false;
|
boolean online;
|
||||||
int lastServer = -1;
|
int lastServer;
|
||||||
|
|
||||||
// First query: check basic player data and check whether player can join into server.
|
// First query: check basic player data and check whether player can join into server.
|
||||||
JDBCsetUp.QueryResult qr1 = JDBCsetUp.executeQuery("SELECT online, last_server FROM player_data WHERE uuid='" + player_uuid + "'");
|
JDBCsetUp.QueryResult qr1 = JDBCsetUp.executeQuery("SELECT online, last_server FROM player_data WHERE uuid='" + player_uuid + "'");
|
||||||
|
|
@ -410,8 +410,7 @@ public class VanillaSync {
|
||||||
dynamicTagInput,
|
dynamicTagInput,
|
||||||
snbtDataVersion,
|
snbtDataVersion,
|
||||||
currentDataVersion);
|
currentDataVersion);
|
||||||
CompoundTag compoundTag = (CompoundTag) updatedDynamicTag.getValue();
|
return (CompoundTag) updatedDynamicTag.getValue();
|
||||||
return compoundTag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public class JDBCsetUp {
|
||||||
Connection connection = getConnection(); // With database selected (and "USE" already run)
|
Connection connection = getConnection(); // With database selected (and "USE" already run)
|
||||||
PreparedStatement queryStatement = connection.prepareStatement(sql);
|
PreparedStatement queryStatement = connection.prepareStatement(sql);
|
||||||
ResultSet resultSet = queryStatement.executeQuery();
|
ResultSet resultSet = queryStatement.executeQuery();
|
||||||
return new QueryResult(connection, resultSet);
|
return new QueryResult(connection, queryStatement, resultSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -94,7 +94,7 @@ public class JDBCsetUp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public record QueryResult(Connection connection, ResultSet resultSet) implements AutoCloseable {
|
public record QueryResult(Connection connection,PreparedStatement preparedStatement, ResultSet resultSet) implements AutoCloseable {
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
if (resultSet != null) {
|
if (resultSet != null) {
|
||||||
|
|
@ -105,6 +105,14 @@ public class JDBCsetUp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (preparedStatement != null) {
|
||||||
|
try {
|
||||||
|
preparedStatement.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error("Error closing PreparedStatement", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
try {
|
try {
|
||||||
connection.close();
|
connection.close();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user