Removed NicknamesTable#getNicknames - not used

This commit is contained in:
Rsl1122 2019-02-02 12:23:59 +02:00
parent af674919e7
commit a62b4ae61e
3 changed files with 4 additions and 49 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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());
}