🪲 fix bug where players can still cancel items with bids on them using the end all button

Took 4 minutes
This commit is contained in:
Kiran Hart 2023-07-30 18:21:49 -04:00
parent 71ce6eee64
commit bf5803f342
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
2 changed files with 11 additions and 1 deletions

View File

@ -232,4 +232,8 @@ public class AuctionedItem {
itemStack.setItemMeta(meta);
return itemStack;
}
public boolean containsValidBid() {
return isBidItem() && !this.highestBidder.equals(this.owner);
}
}

View File

@ -152,7 +152,13 @@ public class GUIActiveAuctions extends AbstractPlaceholderGui {
setButton(5, 4, getRefreshButtonItem(), e -> e.manager.showGUI(e.player, new GUIActiveAuctions(this.auctionPlayer)));
setButton(5, 1, ConfigurationItemHelper.createConfigurationItem(this.player, Settings.GUI_ACTIVE_AUCTIONS_ITEM.getString(), Settings.GUI_ACTIVE_AUCTIONS_NAME.getString(), Settings.GUI_ACTIVE_AUCTIONS_LORE.getStringList(), null), e -> {
this.auctionPlayer.getItems(false).forEach(item -> item.setExpired(true));
for (AuctionedItem item : this.auctionPlayer.getItems(false)) {
if (Settings.SELLERS_MUST_WAIT_FOR_TIME_LIMIT_AFTER_BID.getBoolean() && item.containsValidBid())
continue;
item.setExpired(true);
}
draw();
});
}