mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-01-07 12:47:36 +01:00
fix cancel bug giving item despite not taking it
Took 5 minutes
This commit is contained in:
parent
f97007e428
commit
4bcefadb1a
@ -348,7 +348,7 @@ public final class CommandSell extends AbstractCommand {
|
||||
AuctionHouse.getInstance().getAuctionPlayerManager().processSell(player);
|
||||
|
||||
player.closeInventory();
|
||||
PlayerUtils.giveItem(player, auctionedItem.getItem());
|
||||
// PlayerUtils.giveItem(player, auctionedItem.getItem());
|
||||
auctionPlayer.setItemBeingListed(null);
|
||||
return;
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ import ca.tweetzy.core.utils.TextUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public final class GUIListingConfirm extends AbstractPlaceholderGui {
|
||||
@ -33,6 +36,8 @@ public final class GUIListingConfirm extends AbstractPlaceholderGui {
|
||||
private final AuctionedItem auctionedItem;
|
||||
private final Consumer<Boolean> result;
|
||||
|
||||
private final Set<UUID> resulted = new HashSet<>();
|
||||
|
||||
public GUIListingConfirm(Player player, AuctionedItem auctionedItem, Consumer<Boolean> result) {
|
||||
super(player);
|
||||
this.auctionedItem = auctionedItem;
|
||||
@ -44,16 +49,23 @@ public final class GUIListingConfirm extends AbstractPlaceholderGui {
|
||||
draw();
|
||||
}
|
||||
|
||||
|
||||
private void draw() {
|
||||
setItems(0, 3, getConfirmListingYesItem());
|
||||
setItem(0, 4, this.auctionedItem.getDisplayStack(AuctionStackType.LISTING_PREVIEW));
|
||||
setItems(5, 8, getConfirmListingNoItem());
|
||||
|
||||
setActionForRange(5, 8, ClickType.LEFT, e -> {
|
||||
if (resulted.contains(e.player.getUniqueId())) return;
|
||||
resulted.add(e.player.getUniqueId());
|
||||
|
||||
setAllowClose(true);
|
||||
this.result.accept(false);
|
||||
});
|
||||
setActionForRange(0, 3, ClickType.LEFT, e -> {
|
||||
if (resulted.contains(e.player.getUniqueId())) return;
|
||||
resulted.add(e.player.getUniqueId());
|
||||
|
||||
setAllowClose(true);
|
||||
this.result.accept(true);
|
||||
});
|
||||
|
@ -37,6 +37,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
@ -149,7 +150,6 @@ public final class AuctionCreator {
|
||||
|
||||
//====================================================================================
|
||||
|
||||
|
||||
// Actually attempt the insertion now
|
||||
AuctionHouse.getInstance().getDataManager().insertAuctionAsync(auctionItem, (error, inserted) -> {
|
||||
auctionPlayer.setItemBeingListed(null);
|
||||
|
Loading…
Reference in New Issue
Block a user