commit
d78c84d8ce
|
|
@ -142,8 +142,8 @@ public class VanillaSync {
|
|||
try {
|
||||
String player_uuid = event.getProfile().getId().toString();
|
||||
PlayerSync.LOGGER.info("Detected connection from player" + player_uuid + ",starting checking");
|
||||
boolean online = false;
|
||||
int lastServer = -1;
|
||||
boolean online;
|
||||
int lastServer;
|
||||
|
||||
// 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 + "'");
|
||||
|
|
@ -410,8 +410,7 @@ public class VanillaSync {
|
|||
dynamicTagInput,
|
||||
snbtDataVersion,
|
||||
currentDataVersion);
|
||||
CompoundTag compoundTag = (CompoundTag) updatedDynamicTag.getValue();
|
||||
return compoundTag;
|
||||
return (CompoundTag) updatedDynamicTag.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class JDBCsetUp {
|
|||
Connection connection = getConnection(); // With database selected (and "USE" already run)
|
||||
PreparedStatement queryStatement = connection.prepareStatement(sql);
|
||||
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
|
||||
public void close() {
|
||||
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) {
|
||||
try {
|
||||
connection.close();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user