Removed ServerTable#getServerInfo

This commit is contained in:
Rsl1122 2019-02-02 12:55:16 +02:00
parent eadc45d7ed
commit 15c414e2ab
2 changed files with 1 additions and 27 deletions

View File

@ -55,7 +55,7 @@ public class ServerContainerQuery implements Query<ServerContainer> {
public ServerContainer executeQuery(SQLDB db) { public ServerContainer executeQuery(SQLDB db) {
ServerContainer container = new ServerContainer(); ServerContainer container = new ServerContainer();
Optional<Server> serverInfo = db.getServerTable().getServerInfo(serverUUID); Optional<Server> serverInfo = db.query(OptionalFetchQueries.fetchMatchingServerIdentifier(serverUUID));
if (!serverInfo.isPresent()) { if (!serverInfo.isPresent()) {
return container; return container;
} }

View File

@ -181,32 +181,6 @@ public class ServerTable extends Table {
}); });
} }
public Optional<Server> getServerInfo(UUID serverUUID) {
String sql = Select.from(tableName, "*")
.where(SERVER_UUID + "=?")
.toString();
return query(new QueryStatement<Optional<Server>>(sql) {
@Override
public void prepare(PreparedStatement statement) throws SQLException {
statement.setString(1, serverUUID.toString());
}
@Override
public Optional<Server> processResults(ResultSet set) throws SQLException {
if (set.next()) {
return Optional.of(new Server(
set.getInt(SERVER_ID),
UUID.fromString(set.getString(SERVER_UUID)),
set.getString(NAME),
set.getString(WEB_ADDRESS),
set.getInt(MAX_PLAYERS)));
}
return Optional.empty();
}
});
}
public void setAsUninstalled(UUID serverUUID) { public void setAsUninstalled(UUID serverUUID) {
String sql = "UPDATE " + tableName + " SET " + INSTALLED + "=? WHERE " + SERVER_UUID + "=?"; String sql = "UPDATE " + tableName + " SET " + INSTALLED + "=? WHERE " + SERVER_UUID + "=?";