mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 11:37:41 +01:00
Removed ServerTable#getServerInfo
This commit is contained in:
parent
eadc45d7ed
commit
15c414e2ab
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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 + "=?";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user