🔨 fixed visual bug with the collection and active listing buttons showing the incorrect expired/active listing numbers

Took 17 minutes
This commit is contained in:
Kiran Hart 2024-10-19 11:57:11 -04:00
parent c80b01a255
commit 0f6a649a03
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
5 changed files with 28 additions and 14 deletions

View File

@ -8,7 +8,7 @@
<name>AuctionHouse</name> <name>AuctionHouse</name>
<description>The ultimate auction solution for your server</description> <description>The ultimate auction solution for your server</description>
<version>2.126.0</version> <version>2.126.1</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<author>Kiran Hart</author> <author>Kiran Hart</author>

View File

@ -122,9 +122,9 @@ public class AuctionPlayer {
final List<AuctionedItem> items = new ArrayList<>(); final List<AuctionedItem> items = new ArrayList<>();
final AuctionHouse instance = AuctionHouse.getInstance(); final AuctionHouse instance = AuctionHouse.getInstance();
for (Map.Entry<UUID, AuctionedItem> entry : instance.getAuctionItemManager().getItems().entrySet()) { for (Map.Entry<UUID, AuctionedItem> entry : AuctionHouse.getAuctionItemManager().getItems().entrySet()) {
final AuctionedItem auctionItem = entry.getValue(); final AuctionedItem auctionItem = entry.getValue();
if (auctionItem.getOwner().equals(this.uuid) && !instance.getAuctionItemManager().getGarbageBin().containsKey(auctionItem.getId())) { if (auctionItem.getOwner().equals(this.uuid) && !AuctionHouse.getAuctionItemManager().getGarbageBin().containsKey(auctionItem.getId())) {
items.add(auctionItem); items.add(auctionItem);
} }
} }
@ -136,10 +136,9 @@ public class AuctionPlayer {
this.player = Bukkit.getPlayer(this.uuid); this.player = Bukkit.getPlayer(this.uuid);
final List<AuctionedItem> items = new ArrayList<>(); final List<AuctionedItem> items = new ArrayList<>();
final AuctionHouse instance = AuctionHouse.getInstance(); for (Map.Entry<UUID, AuctionedItem> entry : AuctionHouse.getAuctionItemManager().getItems().entrySet()) {
for (Map.Entry<UUID, AuctionedItem> entry : instance.getAuctionItemManager().getItems().entrySet()) {
final AuctionedItem auctionItem = entry.getValue(); final AuctionedItem auctionItem = entry.getValue();
if (auctionItem.getOwner().equals(this.uuid) && auctionItem.isExpired() == getExpired && !instance.getAuctionItemManager().getGarbageBin().containsKey(auctionItem.getId())) { if (auctionItem.getOwner().equals(this.uuid) && auctionItem.isExpired() == getExpired && !AuctionHouse.getAuctionItemManager().getGarbageBin().containsKey(auctionItem.getId())) {
items.add(auctionItem); items.add(auctionItem);
} }
} }

View File

@ -81,6 +81,7 @@ public abstract class AuctionUpdatingPagedGUI<T> extends BaseGUI {
protected void prePopulate() { protected void prePopulate() {
} }
protected void drawFixed() { protected void drawFixed() {
} }

View File

@ -82,7 +82,7 @@ public class GUIActiveAuctions extends AuctionUpdatingPagedGUI<AuctionedItem> {
switch (click.clickType) { switch (click.clickType) {
case LEFT: case LEFT:
if (item.isRequest()) { if (item.isRequest()) {
AuctionHouse.getInstance().getAuctionItemManager().sendToGarbage(item); AuctionHouse.getAuctionItemManager().sendToGarbage(item);
cancelTask(); cancelTask();
click.manager.showGUI(click.player, new GUIActiveAuctions(this.auctionPlayer)); click.manager.showGUI(click.player, new GUIActiveAuctions(this.auctionPlayer));
return; return;
@ -176,7 +176,7 @@ public class GUIActiveAuctions extends AuctionUpdatingPagedGUI<AuctionedItem> {
} else { } else {
setButton(getBackExitButtonSlot(), getBackButton(), click -> { setButton(getBackExitButtonSlot(), getBackButton(), click -> {
cancelTask(); cancelTask();
click.manager.showGUI(click.player, this.parent); click.manager.showGUI(click.player, new GUIAuctionHouse(this.auctionPlayer));
}); });
} }

View File

@ -48,15 +48,24 @@ public class GUIExpiredItems extends AuctionPagedGUI<AuctionedItem> {
private final AuctionPlayer auctionPlayer; private final AuctionPlayer auctionPlayer;
private Long lastClicked = null; private Long lastClicked = null;
private Gui parent;
public GUIExpiredItems(Gui parent, AuctionPlayer auctionPlayer) {
public GUIExpiredItems(Gui parent, AuctionPlayer auctionPlayer, Long lastClicked) {
super(parent, auctionPlayer.getPlayer(), Settings.GUI_EXPIRED_AUCTIONS_TITLE.getString(), 6, new ArrayList<>(auctionPlayer.getItems(true))); super(parent, auctionPlayer.getPlayer(), Settings.GUI_EXPIRED_AUCTIONS_TITLE.getString(), 6, new ArrayList<>(auctionPlayer.getItems(true)));
this.parent = parent;
this.auctionPlayer = auctionPlayer; this.auctionPlayer = auctionPlayer;
this.lastClicked = lastClicked;
draw(); draw();
} }
public GUIExpiredItems(Gui parent, AuctionPlayer auctionPlayer) {
this(parent, auctionPlayer, null);
}
public GUIExpiredItems(AuctionPlayer auctionPlayer, Long lastClicked) { public GUIExpiredItems(AuctionPlayer auctionPlayer, Long lastClicked) {
this(null, auctionPlayer); this(null, auctionPlayer, lastClicked);
this.lastClicked = lastClicked; this.lastClicked = lastClicked;
} }
@ -76,7 +85,7 @@ public class GUIExpiredItems extends AuctionPagedGUI<AuctionedItem> {
@Override @Override
protected void onClick(AuctionedItem auctionedItem, GuiClickEvent click) { protected void onClick(AuctionedItem auctionedItem, GuiClickEvent click) {
if (AuctionHouse.getInstance().getBanManager().isStillBanned(click.player, BanType.EVERYTHING, BanType.ITEM_COLLECTION)) return; if (AuctionHouse.getBanManager().isStillBanned(click.player, BanType.EVERYTHING, BanType.ITEM_COLLECTION)) return;
if (!Settings.ALLOW_INDIVIDUAL_ITEM_CLAIM.getBoolean()) return; if (!Settings.ALLOW_INDIVIDUAL_ITEM_CLAIM.getBoolean()) return;
@ -112,13 +121,18 @@ public class GUIExpiredItems extends AuctionPagedGUI<AuctionedItem> {
PlayerUtils.giveItem(click.player, item); PlayerUtils.giveItem(click.player, item);
} }
AuctionHouse.getInstance().getAuctionItemManager().sendToGarbage(auctionedItem); AuctionHouse.getAuctionItemManager().sendToGarbage(auctionedItem);
click.manager.showGUI(click.player, new GUIExpiredItems(this.auctionPlayer, this.lastClicked)); click.manager.showGUI(click.player, new GUIExpiredItems(this.parent, this.auctionPlayer, this.lastClicked));
} }
@Override @Override
protected void drawFixed() { protected void drawFixed() {
applyBackExit(); setButton(getBackExitButtonSlot(), this.parent == null ? getExitButton() : getBackButton(), click -> {
if (this.parent == null)
click.gui.close();
else
click.manager.showGUI(click.player, new GUIAuctionHouse(this.auctionPlayer));
});
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) { if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) {
setButton(5, 2, QuickItem setButton(5, 2, QuickItem