From 0f6a649a03aa74b6bfa038850ea03d9cce5be439 Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Sat, 19 Oct 2024 11:57:11 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20fixed=20visual=20bug=20with=20th?= =?UTF-8?q?e=20collection=20and=20active=20listing=20buttons=20showing=20t?= =?UTF-8?q?he=20incorrect=20expired/active=20listing=20numbers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Took 17 minutes --- pom.xml | 2 +- .../auctionhouse/auction/AuctionPlayer.java | 9 +++---- .../guis/AuctionUpdatingPagedGUI.java | 1 + .../guis/core/GUIActiveAuctions.java | 4 +-- .../guis/core/GUIExpiredItems.java | 26 ++++++++++++++----- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index fa854b3..2c30df2 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ AuctionHouse The ultimate auction solution for your server - 2.126.0 + 2.126.1 jar Kiran Hart diff --git a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPlayer.java b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPlayer.java index 128b03f..925b059 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPlayer.java +++ b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionPlayer.java @@ -122,9 +122,9 @@ public class AuctionPlayer { final List items = new ArrayList<>(); final AuctionHouse instance = AuctionHouse.getInstance(); - for (Map.Entry entry : instance.getAuctionItemManager().getItems().entrySet()) { + for (Map.Entry 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 items = new ArrayList<>(); - final AuctionHouse instance = AuctionHouse.getInstance(); - for (Map.Entry entry : instance.getAuctionItemManager().getItems().entrySet()) { + for (Map.Entry 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); } } diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/AuctionUpdatingPagedGUI.java b/src/main/java/ca/tweetzy/auctionhouse/guis/AuctionUpdatingPagedGUI.java index 3b4c6ff..4c4a909 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/AuctionUpdatingPagedGUI.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/AuctionUpdatingPagedGUI.java @@ -81,6 +81,7 @@ public abstract class AuctionUpdatingPagedGUI extends BaseGUI { protected void prePopulate() { } + protected void drawFixed() { } diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/core/GUIActiveAuctions.java b/src/main/java/ca/tweetzy/auctionhouse/guis/core/GUIActiveAuctions.java index 9882c39..993af27 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/core/GUIActiveAuctions.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/core/GUIActiveAuctions.java @@ -82,7 +82,7 @@ public class GUIActiveAuctions extends AuctionUpdatingPagedGUI { 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 { } else { setButton(getBackExitButtonSlot(), getBackButton(), click -> { cancelTask(); - click.manager.showGUI(click.player, this.parent); + click.manager.showGUI(click.player, new GUIAuctionHouse(this.auctionPlayer)); }); } diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/core/GUIExpiredItems.java b/src/main/java/ca/tweetzy/auctionhouse/guis/core/GUIExpiredItems.java index 6962225..81bcf2b 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/core/GUIExpiredItems.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/core/GUIExpiredItems.java @@ -48,15 +48,24 @@ public class GUIExpiredItems extends AuctionPagedGUI { 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 { @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 { 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