mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-24 01:58:25 +01:00
Removed NicknamesTable#getNicknames - not used
This commit is contained in:
parent
af674919e7
commit
a62b4ae61e
@ -82,52 +82,6 @@ public class NicknamesTable extends Table {
|
||||
.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nicknames of the user on a server.
|
||||
*
|
||||
* @param uuid UUID of the Player
|
||||
* @param serverUUID UUID of the server
|
||||
* @return The nicknames of the User
|
||||
*/
|
||||
public List<String> getNicknames(UUID uuid, UUID serverUUID) {
|
||||
String sql = "SELECT " + NICKNAME + " FROM " + tableName +
|
||||
" WHERE (" + USER_UUID + "=?)" +
|
||||
" AND " + SERVER_UUID + "=?";
|
||||
|
||||
return query(new QueryStatement<List<String>>(sql, 1000) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, serverUUID.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> processResults(ResultSet set) throws SQLException {
|
||||
List<String> nicknames = new ArrayList<>();
|
||||
while (set.next()) {
|
||||
String nickname = set.getString(NICKNAME);
|
||||
if (nickname.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (!nicknames.contains(nickname)) {
|
||||
nicknames.add(nickname);
|
||||
}
|
||||
}
|
||||
return nicknames;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nicknames of the user on THIS server.
|
||||
*
|
||||
* @param uuid UUID of the Player
|
||||
* @return The nicknames of the User
|
||||
*/
|
||||
public List<String> getNicknames(UUID uuid) {
|
||||
return getNicknames(uuid, getServerUUID());
|
||||
}
|
||||
|
||||
public void saveUserName(UUID uuid, Nickname name) {
|
||||
List<Nickname> saved = getNicknameInformation(uuid);
|
||||
if (saved.contains(name)) {
|
||||
@ -166,7 +120,7 @@ public class NicknamesTable extends Table {
|
||||
NICKNAME + ", " +
|
||||
LAST_USED + ", " +
|
||||
SERVER_UUID +
|
||||
" FROM " + tableName +
|
||||
" FROM " + TABLE_NAME +
|
||||
" WHERE (" + USER_UUID + "=?)";
|
||||
|
||||
return query(new QueryStatement<List<Nickname>>(sql, 5000) {
|
||||
|
@ -24,6 +24,7 @@ import com.djrapitops.plan.data.container.UserInfo;
|
||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
||||
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
||||
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
||||
import com.djrapitops.plan.data.store.objects.Nickname;
|
||||
import com.djrapitops.plan.db.SQLDB;
|
||||
import com.djrapitops.plan.db.access.queries.LargeFetchQueries;
|
||||
import com.djrapitops.plan.db.access.queries.OptionalFetchQueries;
|
||||
@ -134,7 +135,7 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
||||
|
||||
@Override
|
||||
public List<String> getNicknames(UUID uuid) {
|
||||
return nicknamesTable.getNicknames(uuid);
|
||||
return nicknamesTable.getNicknameInformation(uuid).stream().map(Nickname::getName).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -488,7 +488,7 @@ public abstract class CommonDBTest {
|
||||
|
||||
assertFalse(db.query(PlayerFetchQueries.isPlayerRegistered(playerUUID)));
|
||||
assertFalse(db.query(PlayerFetchQueries.isPlayerRegisteredOnServer(playerUUID, serverUUID)));
|
||||
assertTrue(nicknamesTable.getNicknames(playerUUID).isEmpty());
|
||||
assertTrue(nicknamesTable.getNicknameInformation(playerUUID).isEmpty());
|
||||
assertTrue(db.query(PlayerFetchQueries.playerGeoInfo(playerUUID)).isEmpty());
|
||||
assertTrue(sessionsTable.getSessions(playerUUID).isEmpty());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user