🔨 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>
<description>The ultimate auction solution for your server</description>
<version>2.126.0</version>
<version>2.126.1</version>
<packaging>jar</packaging>
<properties>
<author>Kiran Hart</author>

View File

@ -122,9 +122,9 @@ public class AuctionPlayer {
final List<AuctionedItem> items = new ArrayList<>();
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();
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);
}
}
@ -136,10 +136,9 @@ public class AuctionPlayer {
this.player = Bukkit.getPlayer(this.uuid);
final List<AuctionedItem> items = new ArrayList<>();
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();
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);
}
}

View File

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

View File

@ -82,7 +82,7 @@ public class GUIActiveAuctions extends AuctionUpdatingPagedGUI<AuctionedItem> {
switch (click.clickType) {
case LEFT:
if (item.isRequest()) {
AuctionHouse.getInstance().getAuctionItemManager().sendToGarbage(item);
AuctionHouse.getAuctionItemManager().sendToGarbage(item);
cancelTask();
click.manager.showGUI(click.player, new GUIActiveAuctions(this.auctionPlayer));
return;
@ -176,7 +176,7 @@ public class GUIActiveAuctions extends AuctionUpdatingPagedGUI<AuctionedItem> {
} else {
setButton(getBackExitButtonSlot(), getBackButton(), click -> {
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 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)));
this.parent = parent;
this.auctionPlayer = auctionPlayer;
this.lastClicked = lastClicked;
draw();
}
public GUIExpiredItems(Gui parent, AuctionPlayer auctionPlayer) {
this(parent, auctionPlayer, null);
}
public GUIExpiredItems(AuctionPlayer auctionPlayer, Long lastClicked) {
this(null, auctionPlayer);
this(null, auctionPlayer, lastClicked);
this.lastClicked = lastClicked;
}
@ -76,7 +85,7 @@ public class GUIExpiredItems extends AuctionPagedGUI<AuctionedItem> {
@Override
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;
@ -112,13 +121,18 @@ public class GUIExpiredItems extends AuctionPagedGUI<AuctionedItem> {
PlayerUtils.giveItem(click.player, item);
}
AuctionHouse.getInstance().getAuctionItemManager().sendToGarbage(auctionedItem);
click.manager.showGUI(click.player, new GUIExpiredItems(this.auctionPlayer, this.lastClicked));
AuctionHouse.getAuctionItemManager().sendToGarbage(auctionedItem);
click.manager.showGUI(click.player, new GUIExpiredItems(this.parent, this.auctionPlayer, this.lastClicked));
}
@Override
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()) {
setButton(5, 2, QuickItem