Skip to content

Commit

Permalink
sort tablist entries alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Nov 24, 2024
1 parent 75b6a5c commit ffe0f89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/vc/controller/PriorityPlayersController.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public ResponseEntity<PriorityPlayersResponse> priorityPlayers() {
if (response.isEmpty()) {
return ResponseEntity.noContent().build();
}
response.sort((a, b) -> a.playerName().compareToIgnoreCase(b.playerName()));
return ResponseEntity.ok(new PriorityPlayersResponse(response));
}
}
2 changes: 2 additions & 0 deletions src/main/java/vc/controller/TabListController.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public ResponseEntity<TablistResponse> onlinePlayers() {
.fetch()
.stream()
.map(t -> new TablistEntry(t.getPlayerName(), t.getPlayerUuid()))
.sorted((a, b) -> a.playerName().compareToIgnoreCase(b.playerName()))
.toList();
if (players.isEmpty()) {
return ResponseEntity.noContent().build();
Expand Down Expand Up @@ -90,6 +91,7 @@ public ResponseEntity<TablistInfoResponse> onlinePlayersInfo() {
.fetch()
.stream()
.map(t -> new TablistInfoEntry(t.getPlayerName(), t.getPlayerUuid(), t.getPrio(), t.getIsBot()))
.sorted((a, b) -> a.playerName().compareToIgnoreCase(b.playerName()))
.toList();
if (players.isEmpty()) {
return ResponseEntity.noContent().build();
Expand Down

0 comments on commit ffe0f89

Please sign in to comment.