mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-01-07 12:47:36 +01:00
🪲 resolve custom model data issues, also last commit closes #40
Took 17 minutes Took 3 minutes
This commit is contained in:
parent
bd305d7510
commit
c898ddd77f
@ -38,13 +38,12 @@ import ca.tweetzy.core.gui.events.GuiClickEvent;
|
||||
import ca.tweetzy.core.utils.NumberUtils;
|
||||
import ca.tweetzy.core.utils.PlayerUtils;
|
||||
import ca.tweetzy.core.utils.nms.NBTEditor;
|
||||
import ca.tweetzy.flight.utils.QuickItem;
|
||||
import ca.tweetzy.flight.utils.Replacer;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class GUISellAuction extends AbstractPlaceholderGui {
|
||||
@ -85,11 +84,7 @@ public final class GUISellAuction extends AbstractPlaceholderGui {
|
||||
private void draw() {
|
||||
reset();
|
||||
|
||||
setButton(getRows() - 1, 0, QuickItem
|
||||
.of(Settings.GUI_BACK_BTN_ITEM.getString())
|
||||
.name(Settings.GUI_BACK_BTN_NAME.getString())
|
||||
.lore(Settings.GUI_BACK_BTN_LORE.getStringList())
|
||||
.make(), click -> {
|
||||
setButton(getRows() - 1, 0, getPreviousPageItem(), click -> {
|
||||
|
||||
click.gui.close();
|
||||
click.manager.showGUI(click.player, new GUISellPlaceItem(this.auctionPlayer, NBTEditor.contains(this.auctionPlayer.getItemBeingListed(), "AuctionBundleItem") ? GUISellPlaceItem.ViewMode.BUNDLE_ITEM : GUISellPlaceItem.ViewMode.SINGLE_ITEM, ListingType.BIN));
|
||||
@ -99,16 +94,12 @@ public final class GUISellAuction extends AbstractPlaceholderGui {
|
||||
|
||||
final long[] times = AuctionAPI.getInstance().getRemainingTimeValues(this.listingTime);
|
||||
|
||||
setButton(3, 1, QuickItem
|
||||
.of(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_NAME.getString())
|
||||
.lore(Replacer.replaceVariables(
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_LORE.getStringList(),
|
||||
"remaining_days", times[0],
|
||||
"remaining_hours", times[1],
|
||||
"remaining_minutes", times[2],
|
||||
"remaining_seconds", times[3]
|
||||
)).make(), click -> {
|
||||
setButton(3, 1, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_ITEM.getString(), Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_NAME.getString(), Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_LORE.getStringList(), new HashMap<String, Object>() {{
|
||||
put("%remaining_days%", times[0]);
|
||||
put("%remaining_hours%", times[1]);
|
||||
put("%remaining_minutes%", times[2]);
|
||||
put("%remaining_seconds%", times[3]);
|
||||
}}), click -> {
|
||||
|
||||
click.gui.exit();
|
||||
new TitleInput(
|
||||
@ -151,10 +142,14 @@ public final class GUISellAuction extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
if (Settings.ALLOW_USAGE_OF_BUY_NOW_SYSTEM.getBoolean())
|
||||
setButton(3, 4, QuickItem
|
||||
.of(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_PRICE_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_PRICE_NAME.getString())
|
||||
.lore(Replacer.replaceVariables(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_PRICE_LORE.getStringList(), "listing_bin_price", AuctionAPI.getInstance().formatNumber(this.binPrice))).make(), click -> {
|
||||
setButton(3, 4, ConfigurationItemHelper.createConfigurationItem(
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_PRICE_ITEM.getString(),
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_PRICE_NAME.getString(),
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_PRICE_LORE.getStringList(),
|
||||
new HashMap<String, Object>() {{
|
||||
put("%listing_bin_price%", AuctionAPI.getInstance().formatNumber(binPrice));
|
||||
}}
|
||||
), click -> {
|
||||
|
||||
click.gui.exit();
|
||||
new TitleInput(click.player, AuctionHouse.getInstance().getLocale().getMessage("titles.buy now price.title").getMessage(), AuctionHouse.getInstance().getLocale().getMessage("titles.buy now price.subtitle").getMessage()) {
|
||||
@ -195,10 +190,15 @@ public final class GUISellAuction extends AbstractPlaceholderGui {
|
||||
};
|
||||
});
|
||||
|
||||
setButton(3, 3, QuickItem
|
||||
.of(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_STARTING_PRICE_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_STARTING_PRICE_NAME.getString())
|
||||
.lore(Replacer.replaceVariables(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_STARTING_PRICE_LORE.getStringList(), "listing_start_price", AuctionAPI.getInstance().formatNumber(this.startingBid))).make(), click -> {
|
||||
|
||||
setButton(3, 3, ConfigurationItemHelper.createConfigurationItem(
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_STARTING_PRICE_ITEM.getString(),
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_STARTING_PRICE_NAME.getString(),
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_STARTING_PRICE_LORE.getStringList(),
|
||||
new HashMap<String, Object>() {{
|
||||
put("%listing_start_price%", AuctionAPI.getInstance().formatNumber(startingBid));
|
||||
}}
|
||||
), click -> {
|
||||
|
||||
click.gui.exit();
|
||||
new TitleInput(click.player, AuctionHouse.getInstance().getLocale().getMessage("titles.starting bid price.title").getMessage(), AuctionHouse.getInstance().getLocale().getMessage("titles.starting bid price.subtitle").getMessage()) {
|
||||
@ -245,10 +245,14 @@ public final class GUISellAuction extends AbstractPlaceholderGui {
|
||||
};
|
||||
});
|
||||
|
||||
setButton(3, 5, QuickItem
|
||||
.of(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_INCREMENT_PRICE_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_INCREMENT_PRICE_NAME.getString())
|
||||
.lore(Replacer.replaceVariables(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_INCREMENT_PRICE_LORE.getStringList(), "listing_increment_price", AuctionAPI.getInstance().formatNumber(this.bidIncrement))).make(), click -> {
|
||||
setButton(3, 5, ConfigurationItemHelper.createConfigurationItem(
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_INCREMENT_PRICE_ITEM.getString(),
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_INCREMENT_PRICE_NAME.getString(),
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_INCREMENT_PRICE_LORE.getStringList(),
|
||||
new HashMap<String, Object>() {{
|
||||
put("%listing_increment_price%", AuctionAPI.getInstance().formatNumber(bidIncrement));
|
||||
}}
|
||||
), click -> {
|
||||
|
||||
click.gui.exit();
|
||||
new TitleInput(click.player, AuctionHouse.getInstance().getLocale().getMessage("titles.bid increment price.title").getMessage(), AuctionHouse.getInstance().getLocale().getMessage("titles.bid increment price.subtitle").getMessage()) {
|
||||
@ -292,11 +296,12 @@ public final class GUISellAuction extends AbstractPlaceholderGui {
|
||||
drawAuctionItem();
|
||||
drawBuyoutToggle();
|
||||
|
||||
setButton(getRows() - 1, 4, QuickItem
|
||||
.of(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_CONTINUE_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_CONTINUE_NAME.getString())
|
||||
.lore(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_CONTINUE_LORE.getStringList())
|
||||
.make(), click -> {
|
||||
setButton(getRows() - 1, 4, ConfigurationItemHelper.createConfigurationItem(
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_CONTINUE_ITEM.getString(),
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_CONTINUE_NAME.getString(),
|
||||
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_CONTINUE_LORE.getStringList(),
|
||||
null
|
||||
), click -> {
|
||||
|
||||
if (!AuctionAPI.getInstance().meetsListingRequirements(click.player, this.auctionPlayer.getItemBeingListed())) return;
|
||||
if (!auctionPlayer.canListItem()) return;
|
||||
@ -322,10 +327,12 @@ public final class GUISellAuction extends AbstractPlaceholderGui {
|
||||
|
||||
private void drawBuyoutToggle() {
|
||||
if (Settings.ALLOW_USAGE_OF_BUY_NOW_SYSTEM.getBoolean()) {
|
||||
setButton(3, 7, QuickItem
|
||||
.of(this.allowBuyNow ? Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_ENABLED_ITEM.getString() : Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_DISABLED_ITEM.getString())
|
||||
.name(this.allowBuyNow ? Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_ENABLED_NAME.getString() : Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_DISABLED_NAME.getString())
|
||||
.lore(this.allowBuyNow ? Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_ENABLED_LORE.getStringList() : Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_DISABLED_LORE.getStringList()).make(), e -> {
|
||||
setButton(3, 7, ConfigurationItemHelper.createConfigurationItem(
|
||||
this.allowBuyNow ? Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_ENABLED_ITEM.getString() : Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_DISABLED_ITEM.getString(),
|
||||
this.allowBuyNow ? Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_ENABLED_NAME.getString() : Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_DISABLED_NAME.getString(),
|
||||
this.allowBuyNow ? Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_ENABLED_LORE.getStringList() : Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_DISABLED_LORE.getStringList(),
|
||||
null
|
||||
), e -> {
|
||||
|
||||
this.allowBuyNow = !allowBuyNow;
|
||||
drawBuyoutToggle();
|
||||
|
@ -38,13 +38,12 @@ import ca.tweetzy.core.gui.events.GuiClickEvent;
|
||||
import ca.tweetzy.core.utils.NumberUtils;
|
||||
import ca.tweetzy.core.utils.PlayerUtils;
|
||||
import ca.tweetzy.core.utils.nms.NBTEditor;
|
||||
import ca.tweetzy.flight.utils.QuickItem;
|
||||
import ca.tweetzy.flight.utils.Replacer;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
@ -67,8 +66,7 @@ public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
setRows(6);
|
||||
|
||||
setOnClose(close -> {
|
||||
if (BundleUtil.isBundledItem(this.auctionPlayer.getItemBeingListed()))
|
||||
PlayerUtils.giveItem(close.player, BundleUtil.extractBundleItems(this.auctionPlayer.getItemBeingListed()));
|
||||
if (BundleUtil.isBundledItem(this.auctionPlayer.getItemBeingListed())) PlayerUtils.giveItem(close.player, BundleUtil.extractBundleItems(this.auctionPlayer.getItemBeingListed()));
|
||||
else {
|
||||
PlayerUtils.giveItem(close.player, this.auctionPlayer.getItemBeingListed());
|
||||
}
|
||||
@ -83,11 +81,7 @@ public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
private void draw() {
|
||||
reset();
|
||||
|
||||
setButton(getRows() - 1, 0, QuickItem
|
||||
.of(Settings.GUI_BACK_BTN_ITEM.getString())
|
||||
.name(Settings.GUI_BACK_BTN_NAME.getString())
|
||||
.lore(Settings.GUI_BACK_BTN_LORE.getStringList())
|
||||
.make(), click -> {
|
||||
setButton(getRows() - 1, 0, getPreviousPageItem(), click -> {
|
||||
|
||||
click.gui.close();
|
||||
click.manager.showGUI(click.player, new GUISellPlaceItem(this.auctionPlayer, NBTEditor.contains(this.auctionPlayer.getItemBeingListed(), "AuctionBundleItem") ? GUISellPlaceItem.ViewMode.BUNDLE_ITEM : GUISellPlaceItem.ViewMode.SINGLE_ITEM, ListingType.BIN));
|
||||
@ -97,25 +91,15 @@ public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
|
||||
final long[] times = AuctionAPI.getInstance().getRemainingTimeValues(this.listingTime);
|
||||
|
||||
setButton(3, 1, QuickItem
|
||||
.of(Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_NAME.getString())
|
||||
.lore(Replacer.replaceVariables(
|
||||
Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_LORE.getStringList(),
|
||||
"remaining_days", times[0],
|
||||
"remaining_hours", times[1],
|
||||
"remaining_minutes", times[2],
|
||||
"remaining_seconds", times[3]
|
||||
)).make(), click -> {
|
||||
setButton(3, 1, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_ITEM.getString(), Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_NAME.getString(), Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_LORE.getStringList(), new HashMap<String, Object>() {{
|
||||
put("%remaining_days%", times[0]);
|
||||
put("%remaining_hours%", times[1]);
|
||||
put("%remaining_minutes%", times[2]);
|
||||
put("%remaining_seconds%", times[3]);
|
||||
}}), click -> {
|
||||
|
||||
click.gui.exit();
|
||||
new TitleInput(
|
||||
click.player,
|
||||
AuctionHouse.getInstance().getLocale().getMessage("titles.listing time.title").getMessage(),
|
||||
AuctionHouse.getInstance().getLocale().getMessage("titles.listing time.subtitle").getMessage(),
|
||||
AuctionHouse.getInstance().getLocale().getMessage("titles.listing time.actionbar").getMessage()
|
||||
) {
|
||||
|
||||
new TitleInput(click.player, AuctionHouse.getInstance().getLocale().getMessage("titles.listing time.title").getMessage(), AuctionHouse.getInstance().getLocale().getMessage("titles.listing time.subtitle").getMessage(), AuctionHouse.getInstance().getLocale().getMessage("titles.listing time.actionbar").getMessage()) {
|
||||
|
||||
|
||||
@Override
|
||||
@ -141,12 +125,11 @@ public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
setButton(3, 4, QuickItem
|
||||
.of(Settings.GUI_SELL_BIN_ITEM_ITEMS_PRICE_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_BIN_ITEM_ITEMS_PRICE_NAME.getString())
|
||||
.lore(Replacer.replaceVariables(Settings.GUI_SELL_BIN_ITEM_ITEMS_PRICE_LORE.getStringList(), "listing_bin_price", AuctionAPI.getInstance().formatNumber(this.listingPrice))).make(), click -> {
|
||||
}
|
||||
setButton(3, 4, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_BIN_ITEM_ITEMS_PRICE_ITEM.getString(), Settings.GUI_SELL_BIN_ITEM_ITEMS_PRICE_NAME.getString(), Settings.GUI_SELL_BIN_ITEM_ITEMS_PRICE_LORE.getStringList(), new HashMap<String, Object>() {{
|
||||
put("%listing_bin_price%", AuctionAPI.getInstance().formatNumber(listingPrice));
|
||||
}}), click -> {
|
||||
|
||||
click.gui.exit();
|
||||
new TitleInput(click.player, AuctionHouse.getInstance().getLocale().getMessage("titles.buy now price.title").getMessage(), AuctionHouse.getInstance().getLocale().getMessage("titles.buy now price.subtitle").getMessage()) {
|
||||
@ -167,11 +150,9 @@ public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
|
||||
double listingAmount = Double.parseDouble(string);
|
||||
|
||||
if (listingAmount < Settings.MIN_AUCTION_PRICE.getDouble())
|
||||
listingAmount = Settings.MIN_AUCTION_PRICE.getDouble();
|
||||
if (listingAmount < Settings.MIN_AUCTION_PRICE.getDouble()) listingAmount = Settings.MIN_AUCTION_PRICE.getDouble();
|
||||
|
||||
if (listingAmount > Settings.MAX_AUCTION_PRICE.getDouble())
|
||||
listingAmount = Settings.MAX_AUCTION_PRICE.getDouble();
|
||||
if (listingAmount > Settings.MAX_AUCTION_PRICE.getDouble()) listingAmount = Settings.MAX_AUCTION_PRICE.getDouble();
|
||||
|
||||
click.manager.showGUI(click.player, new GUISellBin(GUISellBin.this.auctionPlayer, listingAmount, GUISellBin.this.listingTime, GUISellBin.this.allowPartialBuy));
|
||||
|
||||
@ -184,11 +165,13 @@ public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
|
||||
setItem(1, 4, createListingItem().getDisplayStack(AuctionStackType.LISTING_PREVIEW));
|
||||
|
||||
setButton(getRows() - 1, 4, QuickItem
|
||||
.of(Settings.GUI_SELL_BIN_ITEM_ITEMS_CONTINUE_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_BIN_ITEM_ITEMS_CONTINUE_NAME.getString())
|
||||
.lore(Settings.GUI_SELL_BIN_ITEM_ITEMS_CONTINUE_LORE.getStringList())
|
||||
.make(), click -> {
|
||||
|
||||
setButton(getRows() - 1, 4, ConfigurationItemHelper.createConfigurationItem(
|
||||
Settings.GUI_SELL_BIN_ITEM_ITEMS_CONTINUE_ITEM.getString(),
|
||||
Settings.GUI_SELL_BIN_ITEM_ITEMS_CONTINUE_NAME.getString(),
|
||||
Settings.GUI_SELL_BIN_ITEM_ITEMS_CONTINUE_LORE.getStringList(),
|
||||
null
|
||||
), click -> {
|
||||
|
||||
if (!AuctionAPI.getInstance().meetsListingRequirements(click.player, this.auctionPlayer.getItemBeingListed())) return;
|
||||
if (!auctionPlayer.canListItem()) return;
|
||||
@ -198,8 +181,7 @@ public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
// do listing confirmation first
|
||||
if (Settings.ASK_FOR_LISTING_CONFIRMATION.getBoolean()) {
|
||||
click.manager.showGUI(click.player, new GUIListingConfirm(click.player, createListingItem(), confirmed -> {
|
||||
if (confirmed)
|
||||
performAuctionListing(click);
|
||||
if (confirmed) performAuctionListing(click);
|
||||
else {
|
||||
click.player.closeInventory();
|
||||
PlayerUtils.giveItem(click.player, this.auctionPlayer.getItemBeingListed());
|
||||
@ -225,17 +207,18 @@ public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
if (Settings.OPEN_MAIN_AUCTION_HOUSE_AFTER_MENU_LIST.getBoolean()) {
|
||||
player.removeMetadata("AuctionHouseConfirmListing", AuctionHouse.getInstance());
|
||||
click.manager.showGUI(click.player, new GUIAuctionHouse(this.auctionPlayer));
|
||||
} else
|
||||
AuctionHouse.newChain().sync(click.player::closeInventory).execute();
|
||||
} else AuctionHouse.newChain().sync(click.player::closeInventory).execute();
|
||||
});
|
||||
}
|
||||
|
||||
private void drawQtyPurchase() {
|
||||
if (Settings.ALLOW_PURCHASE_OF_SPECIFIC_QUANTITIES.getBoolean()) {
|
||||
setButton(3, 7, QuickItem
|
||||
.of(this.allowPartialBuy ? Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_ENABLED_ITEM.getString() : Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_DISABLED_ITEM.getString())
|
||||
.name(this.allowPartialBuy ? Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_ENABLED_NAME.getString() : Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_DISABLED_NAME.getString())
|
||||
.lore(this.allowPartialBuy ? Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_ENABLED_LORE.getStringList() : Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_DISABLED_LORE.getStringList()).make(), e -> {
|
||||
setButton(3, 7, ConfigurationItemHelper.createConfigurationItem(
|
||||
this.allowPartialBuy ? Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_ENABLED_ITEM.getString() : Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_DISABLED_ITEM.getString(),
|
||||
this.allowPartialBuy ? Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_ENABLED_NAME.getString() : Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_DISABLED_NAME.getString(),
|
||||
this.allowPartialBuy ? Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_ENABLED_LORE.getStringList() : Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_DISABLED_LORE.getStringList(),
|
||||
null
|
||||
), e -> {
|
||||
|
||||
this.allowPartialBuy = !allowPartialBuy;
|
||||
drawQtyPurchase();
|
||||
@ -244,21 +227,7 @@ public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
private AuctionedItem createListingItem() {
|
||||
final AuctionedItem item = new AuctionedItem(
|
||||
UUID.randomUUID(),
|
||||
auctionPlayer.getUuid(),
|
||||
auctionPlayer.getUuid(),
|
||||
auctionPlayer.getPlayer().getName(),
|
||||
auctionPlayer.getPlayer().getName(),
|
||||
MaterialCategorizer.getMaterialCategory(this.auctionPlayer.getItemBeingListed()),
|
||||
this.auctionPlayer.getItemBeingListed(),
|
||||
this.listingPrice,
|
||||
0,
|
||||
0,
|
||||
this.listingPrice,
|
||||
false, false,
|
||||
System.currentTimeMillis() + (this.listingTime * 1000L)
|
||||
);
|
||||
final AuctionedItem item = new AuctionedItem(UUID.randomUUID(), auctionPlayer.getUuid(), auctionPlayer.getUuid(), auctionPlayer.getPlayer().getName(), auctionPlayer.getPlayer().getName(), MaterialCategorizer.getMaterialCategory(this.auctionPlayer.getItemBeingListed()), this.auctionPlayer.getItemBeingListed(), this.listingPrice, 0, 0, this.listingPrice, false, false, System.currentTimeMillis() + (this.listingTime * 1000L));
|
||||
|
||||
item.setAllowPartialBuy(this.allowPartialBuy);
|
||||
return item;
|
||||
|
@ -24,7 +24,6 @@ import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.flight.utils.QuickItem;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
@ -56,19 +55,22 @@ public final class GUISellListingType extends AbstractPlaceholderGui {
|
||||
drawBinButton(2);
|
||||
}
|
||||
|
||||
setButton(getRows() - 1, 0, QuickItem
|
||||
.of(Settings.GUI_SELL_LISTING_TYPE_ITEMS_RETURN_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_LISTING_TYPE_ITEMS_RETURN_NAME.getString())
|
||||
.lore(Settings.GUI_SELL_LISTING_TYPE_ITEMS_RETURN_LORE.getStringList())
|
||||
.make(), click -> click.manager.showGUI(click.player, new GUIAuctionHouse(this.auctionPlayer)));
|
||||
setButton(getRows() - 1, 0, ConfigurationItemHelper.createConfigurationItem(
|
||||
Settings.GUI_SELL_LISTING_TYPE_ITEMS_RETURN_ITEM.getString(),
|
||||
Settings.GUI_SELL_LISTING_TYPE_ITEMS_RETURN_NAME.getString(),
|
||||
Settings.GUI_SELL_LISTING_TYPE_ITEMS_RETURN_LORE.getStringList(),
|
||||
null
|
||||
), click -> click.manager.showGUI(click.player, new GUIAuctionHouse(this.auctionPlayer)));
|
||||
|
||||
}
|
||||
|
||||
private void drawAuctionButton(int col) {
|
||||
setButton(1, col, QuickItem
|
||||
.of(Settings.GUI_SELL_LISTING_TYPE_ITEMS_AUCTION_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_LISTING_TYPE_ITEMS_AUCTION_NAME.getString())
|
||||
.lore(Settings.GUI_SELL_LISTING_TYPE_ITEMS_AUCTION_LORE.getStringList())
|
||||
.make(), click -> {
|
||||
setButton(1, col, ConfigurationItemHelper.createConfigurationItem(
|
||||
Settings.GUI_SELL_LISTING_TYPE_ITEMS_AUCTION_ITEM.getString(),
|
||||
Settings.GUI_SELL_LISTING_TYPE_ITEMS_AUCTION_NAME.getString(),
|
||||
Settings.GUI_SELL_LISTING_TYPE_ITEMS_AUCTION_LORE.getStringList(),
|
||||
null
|
||||
), click -> {
|
||||
|
||||
if (this.listingType != null)
|
||||
this.listingType.accept(ListingType.AUCTION);
|
||||
@ -76,11 +78,12 @@ public final class GUISellListingType extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
private void drawBinButton(int col) {
|
||||
setButton(1, col, QuickItem
|
||||
.of(Settings.GUI_SELL_LISTING_TYPE_ITEMS_BIN_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_LISTING_TYPE_ITEMS_BIN_NAME.getString())
|
||||
.lore(Settings.GUI_SELL_LISTING_TYPE_ITEMS_BIN_LORE.getStringList())
|
||||
.make(), click -> {
|
||||
setButton(1, col, ConfigurationItemHelper.createConfigurationItem(
|
||||
Settings.GUI_SELL_LISTING_TYPE_ITEMS_BIN_ITEM.getString(),
|
||||
Settings.GUI_SELL_LISTING_TYPE_ITEMS_BIN_NAME.getString(),
|
||||
Settings.GUI_SELL_LISTING_TYPE_ITEMS_BIN_LORE.getStringList(),
|
||||
null
|
||||
), click -> {
|
||||
|
||||
if (this.listingType != null)
|
||||
this.listingType.accept(ListingType.BIN);
|
||||
|
@ -26,7 +26,6 @@ import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.utils.PlayerUtils;
|
||||
import ca.tweetzy.flight.utils.QuickItem;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -70,11 +69,7 @@ public final class GUISellPlaceItem extends AbstractPlaceholderGui {
|
||||
|
||||
private void draw() {
|
||||
|
||||
setButton(getRows() - 1, 0, QuickItem
|
||||
.of(Settings.GUI_CLOSE_BTN_ITEM.getString())
|
||||
.name(Settings.GUI_CLOSE_BTN_NAME.getString())
|
||||
.lore(Settings.GUI_CLOSE_BTN_LORE.getStringList())
|
||||
.make(), click -> {
|
||||
setButton(getRows() - 1, 0, getCloseButtonItem(), click -> {
|
||||
|
||||
if (click.cursor.getType() == Material.AIR) {
|
||||
click.gui.close();
|
||||
@ -82,11 +77,12 @@ public final class GUISellPlaceItem extends AbstractPlaceholderGui {
|
||||
}
|
||||
});
|
||||
|
||||
setButton(getRows() - 1, 4, QuickItem
|
||||
.of(Settings.GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_ITEM.getString())
|
||||
.name(Settings.GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_NAME.getString())
|
||||
.lore(Settings.GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_LORE.getStringList())
|
||||
.make(), click -> {
|
||||
setButton(getRows() - 1, 4, ConfigurationItemHelper.createConfigurationItem(
|
||||
Settings.GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_ITEM.getString(),
|
||||
Settings.GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_NAME.getString(),
|
||||
Settings.GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_LORE.getStringList(),
|
||||
null
|
||||
), click -> {
|
||||
|
||||
final ArrayList<ItemStack> items = gatherSellableItems();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user