From 553a2904843d72594e59d80f0f10fdc177711eb3 Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Wed, 7 Dec 2022 11:57:10 -0500 Subject: [PATCH] fix bug where when listing tax is enabled w/confirmation listing, if the player doesn't have enough money to complete listing it dupes the item. Took 2 minutes --- src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java | 1 + .../java/ca/tweetzy/auctionhouse/guis/sell/GUISellAuction.java | 1 + src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellBin.java | 1 + 3 files changed, 3 insertions(+) diff --git a/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java b/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java index d5c1179..e636cf4 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java +++ b/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java @@ -354,6 +354,7 @@ public final class CommandSell extends AbstractCommand { AuctionCreator.create(auctionPlayer, auctionedItem, (auction, listingResult) -> { if (listingResult != ListingResult.SUCCESS) { + player.closeInventory(); PlayerUtils.giveItem(player, auction.getItem()); auctionPlayer.setItemBeingListed(null); return; diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellAuction.java b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellAuction.java index e5bb786..03fe28e 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellAuction.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellAuction.java @@ -335,6 +335,7 @@ public final class GUISellAuction extends AbstractPlaceholderGui { private void performAuctionListing(GuiClickEvent click) { AuctionCreator.create(this.auctionPlayer, createListingItem(), (originalListing, listingResult) -> { if (listingResult != ListingResult.SUCCESS) { + click.player.closeInventory(); PlayerUtils.giveItem(click.player, originalListing.getItem()); this.auctionPlayer.setItemBeingListed(null); return; diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellBin.java b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellBin.java index c7a83ea..54d0ff1 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellBin.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellBin.java @@ -209,6 +209,7 @@ public final class GUISellBin extends AbstractPlaceholderGui { private void performAuctionListing(GuiClickEvent click) { AuctionCreator.create(this.auctionPlayer, createListingItem(), (originalListing, listingResult) -> { if (listingResult != ListingResult.SUCCESS) { + click.player.closeInventory(); PlayerUtils.giveItem(click.player, originalListing.getItem()); this.auctionPlayer.setItemBeingListed(null); return;