mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-25 10:37:51 +01:00
Removed UsersTable#getTimesKicked - not used
This commit is contained in:
parent
30bac0f6ca
commit
c57021a116
@ -54,7 +54,7 @@ public class PlayerContainerQuery implements Query<PlayerContainer> {
|
||||
container.putRawData(PlayerKeys.UUID, uuid);
|
||||
|
||||
Key<BaseUser> baseUserKey = new Key<>(BaseUser.class, "BASE_USER");
|
||||
container.putSupplier(baseUserKey, () -> db.query(BaseUserQueries.fetchCommonUserInformationOfPlayer(uuid)).orElse(null));
|
||||
container.putSupplier(baseUserKey, () -> db.query(BaseUserQueries.fetchBaseUserOfPlayer(uuid)).orElse(null));
|
||||
container.putSupplier(PlayerKeys.REGISTERED, () -> container.getValue(baseUserKey).map(BaseUser::getRegistered).orElse(null));
|
||||
container.putSupplier(PlayerKeys.NAME, () -> container.getValue(baseUserKey).map(BaseUser::getName).orElse(null));
|
||||
container.putSupplier(PlayerKeys.KICK_COUNT, () -> container.getValue(baseUserKey).map(BaseUser::getTimesKicked).orElse(null));
|
||||
|
@ -83,7 +83,7 @@ public class BaseUserQueries {
|
||||
};
|
||||
}
|
||||
|
||||
public static Query<Optional<BaseUser>> fetchCommonUserInformationOfPlayer(UUID playerUUID) {
|
||||
public static Query<Optional<BaseUser>> fetchBaseUserOfPlayer(UUID playerUUID) {
|
||||
String sql = Select.all(UsersTable.TABLE_NAME).where(UsersTable.USER_UUID + "=?").toString();
|
||||
|
||||
return new QueryStatement<Optional<BaseUser>>(sql, 20000) {
|
||||
|
@ -65,27 +65,6 @@ public class UsersTable extends Table {
|
||||
.toString();
|
||||
}
|
||||
|
||||
public int getTimesKicked(UUID uuid) {
|
||||
String sql = Select.from(tableName, TIMES_KICKED)
|
||||
.where(USER_UUID + "=?")
|
||||
.toString();
|
||||
|
||||
return query(new QueryStatement<Integer>(sql) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
statement.setString(1, uuid.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer processResults(ResultSet set) throws SQLException {
|
||||
if (set.next()) {
|
||||
return set.getInt(TIMES_KICKED);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void kicked(UUID uuid) {
|
||||
String sql = "UPDATE " + tableName + " SET "
|
||||
+ TIMES_KICKED + "=" + TIMES_KICKED + "+ 1" +
|
||||
|
@ -457,7 +457,7 @@ public abstract class CommonDBTest {
|
||||
public void testUsersTableKickSaving() throws DBInitException {
|
||||
saveUserOne();
|
||||
UsersTable usersTable = db.getUsersTable();
|
||||
assertEquals(1, usersTable.getTimesKicked(playerUUID));
|
||||
OptionalAssert.equals(1, db.query(BaseUserQueries.fetchBaseUserOfPlayer(playerUUID)).map(BaseUser::getTimesKicked));
|
||||
|
||||
int random = new Random().nextInt(20);
|
||||
|
||||
@ -465,7 +465,7 @@ public abstract class CommonDBTest {
|
||||
usersTable.kicked(playerUUID);
|
||||
}
|
||||
commitTest();
|
||||
assertEquals(random + 2, usersTable.getTimesKicked(playerUUID));
|
||||
OptionalAssert.equals(random + 2, db.query(BaseUserQueries.fetchBaseUserOfPlayer(playerUUID)).map(BaseUser::getTimesKicked));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user