🗃️ added oldest sort type to filter (Closes #76)

Took 3 minutes
This commit is contained in:
Kiran Hart 2023-12-06 15:35:11 -05:00
parent 77af181a79
commit 48d005940e
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
3 changed files with 7 additions and 3 deletions

View File

@ -29,6 +29,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
public enum AuctionSortType {
RECENT("Recent"),
OLDEST("Oldest"),
PRICE("Price");
final String type;
@ -43,6 +44,8 @@ public enum AuctionSortType {
return AuctionHouse.getInstance().getLocale().getMessage("auction_filter.sort_order.price").getMessage();
case RECENT:
return AuctionHouse.getInstance().getLocale().getMessage("auction_filter.sort_order.recent").getMessage();
case OLDEST:
return AuctionHouse.getInstance().getLocale().getMessage("auction_filter.sort_order.oldest").getMessage();
default:
return getType();
}

View File

@ -173,10 +173,10 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
if (this.auctionPlayer.getAuctionSortType() == AuctionSortType.PRICE) {
this.items = this.items.stream().sorted(Comparator.comparingDouble(AuctionedItem::getCurrentPrice).reversed()).collect(Collectors.toList());
}
if (this.auctionPlayer.getAuctionSortType() == AuctionSortType.RECENT) {
}else if (this.auctionPlayer.getAuctionSortType() == AuctionSortType.RECENT) {
this.items = this.items.stream().sorted(Comparator.comparingLong(AuctionedItem::getExpiresAt).reversed()).collect(Collectors.toList());
}else if (this.auctionPlayer.getAuctionSortType() == AuctionSortType.OLDEST) {
this.items = this.items.stream().sorted(Comparator.comparingLong(AuctionedItem::getExpiresAt)).collect(Collectors.toList());
}
}

View File

@ -170,6 +170,7 @@ public class LocaleSettings {
languageNodes.put("auction_filter.categories.search", "Search");
languageNodes.put("auction_filter.sort_order.recent", "Recent");
languageNodes.put("auction_filter.sort_order.price", "Price");
languageNodes.put("auction_filter.sort_order.oldest", "Oldest");
languageNodes.put("transaction_filter.buy_type.sold", "Sold");
languageNodes.put("transaction_filter.buy_type.bought", "Bought");