confirm gui for sell menu

Took 3 minutes
This commit is contained in:
Kiran Hart 2022-07-26 18:43:56 -04:00
parent fd3bc2507b
commit ed0423dbc8
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
2 changed files with 50 additions and 21 deletions

View File

@ -4,6 +4,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmListing;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.compatibility.XMaterial;
@ -329,27 +330,45 @@ public class GUISellItem extends AbstractPlaceholderGui {
return;
}
AuctionAPI.getInstance().listAuction(
e.player,
this.itemToBeListed.clone(),
this.itemToBeListed.clone(),
this.auctionTime,
this.isBiddingItem && !isAllowingBuyNow || !Settings.ALLOW_USAGE_OF_BUY_NOW_SYSTEM.getBoolean() ? -1 : buyNowPrice,
this.isBiddingItem ? bidStartPrice : 0,
Settings.FORCE_CUSTOM_BID_AMOUNT.getBoolean() ? 1 : this.isBiddingItem ? bidIncrementPrice : 0,
this.isBiddingItem ? bidStartPrice : buyNowPrice,
this.isBiddingItem,
false,
false
);
if (Settings.ASK_FOR_LISTING_CONFIRMATION.getBoolean()) {
setAllowClose(true);
AuctionHouse.getInstance().getAuctionPlayerManager().removeItemFromSellHolding(e.player.getUniqueId());
AuctionHouse.getInstance().getAuctionPlayerManager().removeFromUsingSellGUI(e.player.getUniqueId());
setAllowClose(true);
e.gui.close();
AuctionHouse.getInstance().getGuiManager().showGUI(e.player, new GUIConfirmListing(
e.player,
this.itemToBeListed.clone(),
this.itemToBeListed.clone(),
this.auctionTime,
this.isBiddingItem && !isAllowingBuyNow || !Settings.ALLOW_USAGE_OF_BUY_NOW_SYSTEM.getBoolean() ? -1 : buyNowPrice,
this.isBiddingItem ? bidStartPrice : 0,
Settings.FORCE_CUSTOM_BID_AMOUNT.getBoolean() ? 1 : this.isBiddingItem ? bidIncrementPrice : 0,
this.isBiddingItem,
false,
false,
false
));
} else {
AuctionAPI.getInstance().listAuction(
e.player,
this.itemToBeListed.clone(),
this.itemToBeListed.clone(),
this.auctionTime,
this.isBiddingItem && !isAllowingBuyNow || !Settings.ALLOW_USAGE_OF_BUY_NOW_SYSTEM.getBoolean() ? -1 : buyNowPrice,
this.isBiddingItem ? bidStartPrice : 0,
Settings.FORCE_CUSTOM_BID_AMOUNT.getBoolean() ? 1 : this.isBiddingItem ? bidIncrementPrice : 0,
this.isBiddingItem ? bidStartPrice : buyNowPrice,
this.isBiddingItem,
false,
false
);
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean()) {
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
AuctionHouse.getInstance().getAuctionPlayerManager().removeItemFromSellHolding(e.player.getUniqueId());
AuctionHouse.getInstance().getAuctionPlayerManager().removeFromUsingSellGUI(e.player.getUniqueId());
setAllowClose(true);
e.gui.close();
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean()) {
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
}
}
});

View File

@ -1,9 +1,11 @@
package ca.tweetzy.auctionhouse.guis.confirmation;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
import ca.tweetzy.auctionhouse.helpers.MaterialCategorizer;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.compatibility.CompatibleHand;
@ -13,7 +15,6 @@ import ca.tweetzy.core.utils.items.TItemBuilder;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.checkerframework.checker.units.qual.A;
import java.util.Objects;
import java.util.UUID;
@ -95,6 +96,9 @@ public class GUIConfirmListing extends AbstractPlaceholderGui {
});
setActionForRange(0, 3, ClickType.LEFT, e -> {
AuctionHouse.getInstance().getAuctionPlayerManager().removeItemFromSellHolding(e.player.getUniqueId());
AuctionHouse.getInstance().getAuctionPlayerManager().removeFromUsingSellGUI(e.player.getUniqueId());
AuctionAPI.getInstance().listAuction(
this.player,
this.originalItem,
@ -110,7 +114,13 @@ public class GUIConfirmListing extends AbstractPlaceholderGui {
this.isInfinite,
false
);
e.gui.exit();
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean()) {
e.manager.showGUI(e.player, new GUIAuctionHouse(AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(e.player.getUniqueId())));
} else {
e.gui.exit();
}
});
}
}