mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-22 05:25:11 +01:00
🔢 Added model data support to remaining gui elements
Took 13 minutes
This commit is contained in:
parent
0bc5fc2ec6
commit
8c8ffe3914
@ -20,11 +20,12 @@ package ca.tweetzy.auctionhouse.guis;
|
||||
|
||||
import ca.tweetzy.auctionhouse.api.hook.PlaceholderAPIHook;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.gui.Gui;
|
||||
import ca.tweetzy.core.gui.GuiUtils;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Date Created: April 07 2022
|
||||
@ -39,18 +40,75 @@ public abstract class AbstractPlaceholderGui extends Gui {
|
||||
public AbstractPlaceholderGui(Player player) {
|
||||
this.player = player;
|
||||
setUseLockedCells(true);
|
||||
setDefaultItem(GuiUtils.createButtonItem(Settings.GUI_FILLER.getMaterial(), " "));
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILLER.getString()));
|
||||
}
|
||||
|
||||
public AbstractPlaceholderGui(AuctionPlayer player) {
|
||||
this.player = player.getPlayer();
|
||||
setUseLockedCells(true);
|
||||
setDefaultItem(GuiUtils.createButtonItem(Settings.GUI_FILLER.getMaterial(), " "));
|
||||
}
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILLER.getString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Gui setTitle(String message) {
|
||||
super.setTitle(this.player == null ? TextUtils.formatText(message) : TextUtils.formatText(PlaceholderAPIHook.PAPIReplacer.tryReplace(this.player, message)));
|
||||
return this;
|
||||
}
|
||||
|
||||
protected ItemStack getPreviousPageItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_BACK_BTN_ITEM.getString(), Settings.GUI_BACK_BTN_NAME.getString(), Settings.GUI_BACK_BTN_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getNextPageItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_NEXT_BTN_ITEM.getString(), Settings.GUI_NEXT_BTN_NAME.getString(), Settings.GUI_NEXT_BTN_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getRefreshButtonItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_NEXT_BTN_ITEM.getString(), Settings.GUI_NEXT_BTN_NAME.getString(), Settings.GUI_NEXT_BTN_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getCloseButtonItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CLOSE_BTN_ITEM.getString(), Settings.GUI_CLOSE_BTN_NAME.getString(), Settings.GUI_CLOSE_BTN_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getIncreaseQtyButtonItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CONFIRM_INCREASE_QTY_ITEM.getString(), Settings.GUI_CONFIRM_INCREASE_QTY_NAME.getString(), Settings.GUI_CONFIRM_INCREASE_QTY_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getDecreaseQtyButtonItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CONFIRM_DECREASE_QTY_ITEM.getString(), Settings.GUI_CONFIRM_DECREASE_QTY_NAME.getString(), Settings.GUI_CONFIRM_DECREASE_QTY_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
// confirms
|
||||
protected ItemStack getConfirmCancelYesItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CONFIRM_CANCEL_YES_ITEM.getString(), Settings.GUI_CONFIRM_CANCEL_YES_NAME.getString(), Settings.GUI_CONFIRM_CANCEL_YES_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getConfirmCancelNoItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CONFIRM_CANCEL_NO_ITEM.getString(), Settings.GUI_CONFIRM_CANCEL_NO_NAME.getString(), Settings.GUI_CONFIRM_CANCEL_NO_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getConfirmBuyYesItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CONFIRM_BUY_YES_ITEM.getString(), Settings.GUI_CONFIRM_BUY_YES_NAME.getString(), Settings.GUI_CONFIRM_BUY_YES_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getConfirmBuyNoItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CONFIRM_BUY_NO_ITEM.getString(), Settings.GUI_CONFIRM_BUY_NO_NAME.getString(), Settings.GUI_CONFIRM_BUY_NO_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getConfirmListingYesItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CONFIRM_LISTING_YES_ITEM.getString(), Settings.GUI_CONFIRM_LISTING_YES_NAME.getString(), Settings.GUI_CONFIRM_LISTING_YES_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getConfirmListingNoItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CONFIRM_LISTING_NO_ITEM.getString(), Settings.GUI_CONFIRM_LISTING_NO_NAME.getString(), Settings.GUI_CONFIRM_LISTING_NO_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getConfirmBidYesItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CONFIRM_BID_YES_ITEM.getString(), Settings.GUI_CONFIRM_BID_YES_NAME.getString(), Settings.GUI_CONFIRM_BID_YES_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getConfirmBidNoItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CONFIRM_BID_NO_ITEM.getString(), Settings.GUI_CONFIRM_BID_NO_NAME.getString(), Settings.GUI_CONFIRM_BID_NO_LORE.getStringList(), null);
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ public class GUIActiveAuctions extends AbstractPlaceholderGui {
|
||||
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
|
||||
});
|
||||
|
||||
setButton(5, 4, new TItemBuilder(Objects.requireNonNull(Settings.GUI_REFRESH_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_REFRESH_BTN_NAME.getString()).setLore(Settings.GUI_REFRESH_BTN_LORE.getStringList()).toItemStack(), e -> e.manager.showGUI(e.player, new GUIActiveAuctions(this.auctionPlayer)));
|
||||
setButton(5, 4, getRefreshButtonItem(), e -> e.manager.showGUI(e.player, new GUIActiveAuctions(this.auctionPlayer)));
|
||||
|
||||
setButton(5, 1, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_ACTIVE_AUCTIONS_ITEM.getString(), Settings.GUI_ACTIVE_AUCTIONS_NAME.getString(), Settings.GUI_ACTIVE_AUCTIONS_LORE.getStringList(), null), e -> {
|
||||
this.auctionPlayer.getItems(false).forEach(item -> item.setExpired(true));
|
||||
@ -143,8 +143,8 @@ public class GUIActiveAuctions extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
private void drawPaginationButtons() {
|
||||
setPrevPage(5, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_BACK_BTN_NAME.getString()).setLore(Settings.GUI_BACK_BTN_LORE.getStringList()).toItemStack());
|
||||
setNextPage(5, 5, new TItemBuilder(Objects.requireNonNull(Settings.GUI_NEXT_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_NEXT_BTN_NAME.getString()).setLore(Settings.GUI_NEXT_BTN_LORE.getStringList()).toItemStack());
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
setOnPage(e -> {
|
||||
draw();
|
||||
SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString(), 1.0F, 1.0F);
|
||||
|
@ -502,8 +502,8 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
private void drawPaginationButtons() {
|
||||
setPrevPage(Settings.GUI_BACK_BTN_SLOT.getInt(), new TItemBuilder(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_BACK_BTN_NAME.getString()).setLore(Settings.GUI_BACK_BTN_LORE.getStringList()).toItemStack());
|
||||
setNextPage(Settings.GUI_NEXT_BTN_SLOT.getInt(), new TItemBuilder(Objects.requireNonNull(Settings.GUI_NEXT_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_NEXT_BTN_NAME.getString()).setLore(Settings.GUI_NEXT_BTN_LORE.getStringList()).toItemStack());
|
||||
setPrevPage(Settings.GUI_BACK_BTN_SLOT.getInt(), getPreviousPageItem());
|
||||
setNextPage(Settings.GUI_NEXT_BTN_SLOT.getInt(), getNextPageItem());
|
||||
|
||||
setOnPage(e -> {
|
||||
draw();
|
||||
@ -539,7 +539,7 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
if (Settings.GUI_REFRESH_BTN_ENABLED.getBoolean()) {
|
||||
setButton(Settings.GUI_REFRESH_BTN_SLOT.getInt(), new TItemBuilder(Objects.requireNonNull(Settings.GUI_REFRESH_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_REFRESH_BTN_NAME.getString()).setLore(Settings.GUI_REFRESH_BTN_LORE.getStringList()).toItemStack(), e -> {
|
||||
setButton(Settings.GUI_REFRESH_BTN_SLOT.getInt(), getRefreshButtonItem(), e -> {
|
||||
if (Settings.USE_REFRESH_COOL_DOWN.getBoolean()) {
|
||||
if (AuctionHouse.getInstance().getAuctionPlayerManager().getCooldowns().containsKey(this.auctionPlayer.getPlayer().getUniqueId())) {
|
||||
if (AuctionHouse.getInstance().getAuctionPlayerManager().getCooldowns().get(this.auctionPlayer.getPlayer().getUniqueId()) > System.currentTimeMillis()) {
|
||||
|
@ -25,7 +25,6 @@ import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.core.utils.TimeUtils;
|
||||
import ca.tweetzy.core.utils.items.TItemBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -35,7 +34,6 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -53,7 +51,7 @@ public class GUIBans extends AbstractPlaceholderGui {
|
||||
public GUIBans(Player player) {
|
||||
super(player);
|
||||
setTitle(TextUtils.formatText(Settings.GUI_BANS_TITLE.getString()));
|
||||
setDefaultItem(Settings.GUI_BANS_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_BANS_BG_ITEM.getString()));
|
||||
setUseLockedCells(true);
|
||||
setAcceptsItems(false);
|
||||
setAllowDrops(false);
|
||||
@ -75,8 +73,8 @@ public class GUIBans extends AbstractPlaceholderGui {
|
||||
return this.bans.stream().skip((page - 1) * 45L).limit(45L).collect(Collectors.toList());
|
||||
}).asyncLast((data) -> {
|
||||
pages = (int) Math.max(1, Math.ceil(this.bans.size() / (double) 45L));
|
||||
setPrevPage(5, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_BACK_BTN_NAME.getString()).setLore(Settings.GUI_BACK_BTN_LORE.getStringList()).toItemStack());
|
||||
setNextPage(5, 5, new TItemBuilder(Objects.requireNonNull(Settings.GUI_NEXT_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_NEXT_BTN_NAME.getString()).setLore(Settings.GUI_NEXT_BTN_LORE.getStringList()).toItemStack());
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
setOnPage(e -> draw());
|
||||
|
||||
int slot = 0;
|
||||
|
@ -52,7 +52,7 @@ public class GUIBid extends AbstractPlaceholderGui {
|
||||
this.auctionPlayer = auctionPlayer;
|
||||
this.auctionItem = auctionItem;
|
||||
setTitle(TextUtils.formatText(Settings.GUI_BIDDING_TITLE.getString()));
|
||||
setDefaultItem(Settings.GUI_BIDDING_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_BIDDING_BG_ITEM.getString()));
|
||||
setUseLockedCells(true);
|
||||
setAcceptsItems(false);
|
||||
setAllowDrops(false);
|
||||
|
@ -26,7 +26,6 @@ import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmPurchase;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.core.utils.items.TItemBuilder;
|
||||
import ca.tweetzy.core.utils.nms.NBTEditor;
|
||||
import org.bukkit.block.ShulkerBox;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -35,7 +34,6 @@ import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -65,7 +63,7 @@ public class GUIContainerInspect extends AbstractPlaceholderGui {
|
||||
this.container = container;
|
||||
this.fromPurchaseGUI = false;
|
||||
setTitle(TextUtils.formatText(Settings.GUI_INSPECT_TITLE.getString()));
|
||||
setDefaultItem(Settings.GUI_INSPECT_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_INSPECT_BG_ITEM.getString()));
|
||||
setUseLockedCells(false);
|
||||
setAcceptsItems(false);
|
||||
setAllowDrops(false);
|
||||
@ -111,7 +109,7 @@ public class GUIContainerInspect extends AbstractPlaceholderGui {
|
||||
|
||||
for (int i : fillSlots) setItem(i, getDefaultItem());
|
||||
|
||||
setPrevPage(5, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_BACK_BTN_NAME.getString()).setLore(Settings.GUI_BACK_BTN_LORE.getStringList()).toItemStack());
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setButton(5, 4, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CLOSE_BTN_ITEM.getString(), Settings.GUI_CLOSE_BTN_NAME.getString(), Settings.GUI_CLOSE_BTN_LORE.getStringList(), null), e -> {
|
||||
if (fromPurchaseGUI) {
|
||||
AuctionHouse.getInstance().getTransactionManager().addPrePurchase(e.player, auctionItem.getId());
|
||||
@ -120,7 +118,7 @@ public class GUIContainerInspect extends AbstractPlaceholderGui {
|
||||
e.manager.showGUI(e.player, new GUIAuctionHouse(AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(e.player.getUniqueId())));
|
||||
}
|
||||
});
|
||||
setNextPage(5, 5, new TItemBuilder(Objects.requireNonNull(Settings.GUI_NEXT_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_NEXT_BTN_NAME.getString()).setLore(Settings.GUI_NEXT_BTN_LORE.getStringList()).toItemStack());
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
setOnPage(e -> draw());
|
||||
|
||||
int slot = 9;
|
||||
|
@ -76,9 +76,9 @@ public class GUIExpiredItems extends AbstractPlaceholderGui {
|
||||
return this.items.stream().sorted(Comparator.comparingLong(AuctionedItem::getExpiresAt).reversed()).skip((page - 1) * 45L).limit(45).collect(Collectors.toList());
|
||||
}).asyncLast((data) -> {
|
||||
pages = (int) Math.max(1, Math.ceil(this.auctionPlayer.getItems(true).size() / (double) 45));
|
||||
setPrevPage(5, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_BACK_BTN_NAME.getString()).setLore(Settings.GUI_BACK_BTN_LORE.getStringList()).toItemStack());
|
||||
setButton(5, 4, new TItemBuilder(Objects.requireNonNull(Settings.GUI_REFRESH_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_REFRESH_BTN_NAME.getString()).setLore(Settings.GUI_REFRESH_BTN_LORE.getStringList()).toItemStack(), e -> draw());
|
||||
setNextPage(5, 5, new TItemBuilder(Objects.requireNonNull(Settings.GUI_NEXT_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_NEXT_BTN_NAME.getString()).setLore(Settings.GUI_NEXT_BTN_LORE.getStringList()).toItemStack());
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setButton(5, 4, getRefreshButtonItem(), e -> draw());
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
setOnPage(e -> {
|
||||
draw();
|
||||
SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString(), 1.0F, 1.0F);
|
||||
|
@ -24,13 +24,11 @@ import ca.tweetzy.auctionhouse.auction.MinItemPrice;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.core.utils.items.TItemBuilder;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -57,8 +55,8 @@ public final class GUIMinItemPrices extends AbstractPlaceholderGui {
|
||||
|
||||
pages = (int) Math.max(1, Math.ceil(this.minPrices.size() / (double) 45));
|
||||
|
||||
setPrevPage(5, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_BACK_BTN_NAME.getString()).setLore(Settings.GUI_BACK_BTN_LORE.getStringList()).toItemStack());
|
||||
setNextPage(5, 5, new TItemBuilder(Objects.requireNonNull(Settings.GUI_NEXT_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_NEXT_BTN_NAME.getString()).setLore(Settings.GUI_NEXT_BTN_LORE.getStringList()).toItemStack());
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
setOnPage(e -> draw());
|
||||
|
||||
int slot = 0;
|
||||
|
@ -60,8 +60,8 @@ public final class GUIAdminExpired extends AbstractPlaceholderGui {
|
||||
|
||||
AuctionHouse.newChain().asyncFirst(() -> this.items.stream().sorted(Comparator.comparingLong(AuctionedItem::getExpiresAt).reversed()).skip((page - 1) * 45L).limit(45).collect(Collectors.toList())).asyncLast(data -> {
|
||||
pages = (int) Math.max(1, Math.ceil(this.items.size() / (double) 45));
|
||||
setPrevPage(5, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_BACK_BTN_NAME.getString()).setLore(Settings.GUI_BACK_BTN_LORE.getStringList()).toItemStack());
|
||||
setNextPage(5, 5, new TItemBuilder(Objects.requireNonNull(Settings.GUI_NEXT_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_NEXT_BTN_NAME.getString()).setLore(Settings.GUI_NEXT_BTN_LORE.getStringList()).toItemStack());
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
|
||||
setOnPage(e -> {
|
||||
draw();
|
||||
|
@ -53,7 +53,7 @@ public class GUIAdminItem extends AbstractPlaceholderGui {
|
||||
this.auctionPlayer = auctionPlayer;
|
||||
this.auctionItem = auctionItem;
|
||||
setTitle(TextUtils.formatText(Settings.GUI_ITEM_ADMIN_TITLE.getString()));
|
||||
setDefaultItem(Settings.GUI_ITEM_ADMIN_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_ITEM_ADMIN_BG_ITEM.getString()));
|
||||
setRows(3);
|
||||
setAcceptsItems(false);
|
||||
setUseLockedCells(true);
|
||||
|
@ -57,8 +57,8 @@ public final class GUIAdminLogs extends AbstractPlaceholderGui {
|
||||
reset();
|
||||
|
||||
pages = (int) Math.max(1, Math.ceil(this.logs.size() / (double) 45));
|
||||
setPrevPage(5, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_BACK_BTN_NAME.getString()).setLore(Settings.GUI_BACK_BTN_LORE.getStringList()).toItemStack());
|
||||
setNextPage(5, 5, new TItemBuilder(Objects.requireNonNull(Settings.GUI_NEXT_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_NEXT_BTN_NAME.getString()).setLore(Settings.GUI_NEXT_BTN_LORE.getStringList()).toItemStack());
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
setOnPage(e -> draw());
|
||||
|
||||
int slot = 0;
|
||||
|
@ -28,15 +28,12 @@ import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.hooks.EconomyManager;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.core.utils.items.TItemBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* The current file has been created by Kiran Hart
|
||||
* Date Created: March 17 2021
|
||||
@ -84,9 +81,9 @@ public class GUIConfirmBid extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
private void draw() {
|
||||
setItems(0, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_CONFIRM_BID_YES_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_CONFIRM_BID_YES_NAME.getString()).setLore(Settings.GUI_CONFIRM_BID_YES_LORE.getStringList()).toItemStack());
|
||||
setItems(0, 3, getConfirmBidYesItem());
|
||||
placeAuctionItem();
|
||||
setItems(5, 8, new TItemBuilder(Objects.requireNonNull(Settings.GUI_CONFIRM_BID_NO_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_CONFIRM_BID_NO_NAME.getString()).setLore(Settings.GUI_CONFIRM_BID_NO_LORE.getStringList()).toItemStack());
|
||||
setItems(5, 8, getConfirmBidNoItem());
|
||||
|
||||
setActionForRange(5, 8, ClickType.LEFT, e -> {
|
||||
cleanup();
|
||||
|
@ -28,13 +28,10 @@ import ca.tweetzy.auctionhouse.guis.GUIActiveAuctions;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.hooks.EconomyManager;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.core.utils.items.TItemBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* The current file has been created by Kiran Hart
|
||||
* Date Created: May 20 2021
|
||||
@ -57,9 +54,9 @@ public class GUIConfirmCancel extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
private void draw() {
|
||||
setItems(0, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_CONFIRM_CANCEL_YES_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_CONFIRM_CANCEL_YES_NAME.getString()).setLore(Settings.GUI_CONFIRM_CANCEL_YES_LORE.getStringList()).toItemStack());
|
||||
setItems(0, 3, getConfirmCancelYesItem());
|
||||
setItem(0, 4, this.auctionItem.getDisplayStack(AuctionStackType.ACTIVE_AUCTIONS_LIST));
|
||||
setItems(5, 8, new TItemBuilder(Objects.requireNonNull(Settings.GUI_CONFIRM_CANCEL_NO_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_CONFIRM_CANCEL_NO_NAME.getString()).setLore(Settings.GUI_CONFIRM_CANCEL_NO_LORE.getStringList()).toItemStack());
|
||||
setItems(5, 8, getConfirmCancelNoItem());
|
||||
|
||||
setActionForRange(5, 8, ClickType.LEFT, e -> e.manager.showGUI(e.player, new GUIActiveAuctions(this.auctionPlayer)));
|
||||
setActionForRange(0, 3, ClickType.LEFT, e -> {
|
||||
@ -81,6 +78,7 @@ public class GUIConfirmCancel extends AbstractPlaceholderGui {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(oldBidder))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(located.getCurrentPrice())).sendPrefixedMessage(oldBidder.getPlayer());
|
||||
|
||||
}
|
||||
|
||||
|
||||
e.manager.showGUI(e.player, new GUIActiveAuctions(this.auctionPlayer));
|
||||
});
|
||||
|
@ -36,7 +36,6 @@ import ca.tweetzy.core.gui.events.GuiClickEvent;
|
||||
import ca.tweetzy.core.hooks.EconomyManager;
|
||||
import ca.tweetzy.core.utils.PlayerUtils;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.core.utils.items.TItemBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.ShulkerBox;
|
||||
@ -46,7 +45,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* The current file has been created by Kiran Hart
|
||||
@ -81,7 +79,7 @@ public class GUIConfirmPurchase extends AbstractPlaceholderGui {
|
||||
|
||||
if (this.buyingSpecificQuantity) {
|
||||
setUseLockedCells(Settings.GUI_CONFIRM_FILL_BG_ON_QUANTITY.getBoolean());
|
||||
setDefaultItem(Settings.GUI_CONFIRM_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CONFIRM_BG_ITEM.getString()));
|
||||
this.purchaseQuantity = preAmount;
|
||||
this.maxStackSize = preAmount;
|
||||
this.pricePerItem = this.auctionItem.getBasePrice() / this.maxStackSize;
|
||||
@ -103,9 +101,9 @@ public class GUIConfirmPurchase extends AbstractPlaceholderGui {
|
||||
private void draw() {
|
||||
ItemStack deserializeItem = this.auctionItem.getItem().clone();
|
||||
|
||||
setItems(this.buyingSpecificQuantity ? 9 : 0, this.buyingSpecificQuantity ? 12 : 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_CONFIRM_BUY_YES_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_CONFIRM_BUY_YES_NAME.getString()).setLore(Settings.GUI_CONFIRM_BUY_YES_LORE.getStringList()).toItemStack());
|
||||
setItems(this.buyingSpecificQuantity ? 9 : 0, this.buyingSpecificQuantity ? 12 : 3, getConfirmBuyYesItem());
|
||||
setItem(this.buyingSpecificQuantity ? 1 : 0, 4, this.auctionItem.getDisplayStack(AuctionStackType.LISTING_PREVIEW));
|
||||
setItems(this.buyingSpecificQuantity ? 14 : 5, this.buyingSpecificQuantity ? 17 : 8, new TItemBuilder(Objects.requireNonNull(Settings.GUI_CONFIRM_BUY_NO_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_CONFIRM_BUY_NO_NAME.getString()).setLore(Settings.GUI_CONFIRM_BUY_NO_LORE.getStringList()).toItemStack());
|
||||
setItems(this.buyingSpecificQuantity ? 14 : 5, this.buyingSpecificQuantity ? 17 : 8, getConfirmBuyNoItem());
|
||||
|
||||
setAction(this.buyingSpecificQuantity ? 1 : 0, 4, ClickType.LEFT, e -> {
|
||||
if (deserializeItem.getItemMeta() instanceof BlockStateMeta) {
|
||||
@ -226,14 +224,14 @@ public class GUIConfirmPurchase extends AbstractPlaceholderGui {
|
||||
drawPurchaseInfo(this.maxStackSize);
|
||||
|
||||
// Decrease Button
|
||||
setButton(3, 3, new TItemBuilder(Settings.GUI_CONFIRM_DECREASE_QTY_ITEM.getMaterial().parseMaterial()).setName(Settings.GUI_CONFIRM_DECREASE_QTY_NAME.getString()).setLore(Settings.GUI_CONFIRM_DECREASE_QTY_LORE.getStringList()).toItemStack(), e -> {
|
||||
setButton(3, 3, getDecreaseQtyButtonItem(), e -> {
|
||||
if ((this.purchaseQuantity - 1) <= 0) return;
|
||||
this.purchaseQuantity -= 1;
|
||||
drawPurchaseInfo(this.purchaseQuantity);
|
||||
});
|
||||
|
||||
// Increase Button
|
||||
setButton(3, 5, new TItemBuilder(Settings.GUI_CONFIRM_INCREASE_QTY_ITEM.getMaterial().parseMaterial()).setName(Settings.GUI_CONFIRM_INCREASE_QTY_NAME.getString()).setLore(Settings.GUI_CONFIRM_INCREASE_QTY_LORE.getStringList()).toItemStack(), e -> {
|
||||
setButton(3, 5, getIncreaseQtyButtonItem(), e -> {
|
||||
if ((this.purchaseQuantity + 1) > this.maxStackSize) return;
|
||||
this.purchaseQuantity += 1;
|
||||
drawPurchaseInfo(this.purchaseQuantity);
|
||||
|
@ -23,11 +23,9 @@ import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType;
|
||||
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.core.utils.items.TItemBuilder;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public final class GUIListingConfirm extends AbstractPlaceholderGui {
|
||||
@ -47,9 +45,9 @@ public final class GUIListingConfirm extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
private void draw() {
|
||||
setItems(0, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_CONFIRM_LISTING_YES_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_CONFIRM_LISTING_YES_NAME.getString()).setLore(Settings.GUI_CONFIRM_LISTING_YES_LORE.getStringList()).toItemStack());
|
||||
setItems(0, 3, getConfirmListingYesItem());
|
||||
setItem(0, 4, this.auctionedItem.getDisplayStack(AuctionStackType.LISTING_PREVIEW));
|
||||
setItems(5, 8, new TItemBuilder(Objects.requireNonNull(Settings.GUI_CONFIRM_LISTING_NO_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_CONFIRM_LISTING_NO_NAME.getString()).setLore(Settings.GUI_CONFIRM_LISTING_NO_LORE.getStringList()).toItemStack());
|
||||
setItems(5, 8, getConfirmListingNoItem());
|
||||
|
||||
setActionForRange(5, 8, ClickType.LEFT, e -> {
|
||||
setAllowClose(true);
|
||||
|
@ -49,7 +49,7 @@ public class GUIFilterSelection extends AbstractPlaceholderGui {
|
||||
setTitle(TextUtils.formatText(Settings.GUI_FILTER_TITLE.getString()));
|
||||
setRows(4);
|
||||
setAcceptsItems(false);
|
||||
setDefaultItem(Settings.GUI_FILTER_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILTER_BG_ITEM.getString()));
|
||||
setUseLockedCells(true);
|
||||
draw();
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class GUIFilterWhitelist extends AbstractPlaceholderGui {
|
||||
setTitle(TextUtils.formatText(Settings.GUI_FILTER_WHITELIST_TITLE.getString()));
|
||||
setRows(6);
|
||||
setAcceptsItems(false);
|
||||
setDefaultItem(Settings.GUI_FILTER_WHITELIST_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILTER_WHITELIST_BG_ITEM.getString()));
|
||||
setUseLockedCells(true);
|
||||
draw();
|
||||
}
|
||||
|
@ -22,15 +22,14 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionFilterItem;
|
||||
import ca.tweetzy.auctionhouse.auction.enums.AuctionItemCategory;
|
||||
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.core.utils.items.TItemBuilder;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -50,7 +49,7 @@ public class GUIFilterWhitelistList extends AbstractPlaceholderGui {
|
||||
setTitle(TextUtils.formatText(Settings.GUI_FILTER_WHITELIST_LIST_TITLE.getString().replace("%filter_category%", filerCategory.getTranslatedType())));
|
||||
setRows(6);
|
||||
setAcceptsItems(false);
|
||||
setDefaultItem(Settings.GUI_FILTER_WHITELIST_LIST_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILTER_WHITELIST_LIST_BG_ITEM.getString()));
|
||||
setUseLockedCells(true);
|
||||
draw();
|
||||
|
||||
@ -59,9 +58,9 @@ public class GUIFilterWhitelistList extends AbstractPlaceholderGui {
|
||||
|
||||
private void draw() {
|
||||
reset();
|
||||
setPrevPage(5, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_BACK_BTN_NAME.getString()).setLore(Settings.GUI_BACK_BTN_LORE.getStringList()).toItemStack());
|
||||
setButton(5, 4, new TItemBuilder(Objects.requireNonNull(Settings.GUI_CLOSE_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_CLOSE_BTN_NAME.getString()).setLore(Settings.GUI_CLOSE_BTN_LORE.getStringList()).toItemStack(), e -> e.manager.showGUI(e.player, new GUIFilterWhitelist(e.player)));
|
||||
setNextPage(5, 5, new TItemBuilder(Objects.requireNonNull(Settings.GUI_NEXT_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_NEXT_BTN_NAME.getString()).setLore(Settings.GUI_NEXT_BTN_LORE.getStringList()).toItemStack());
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setButton(5, 4, getCloseButtonItem(), e -> e.manager.showGUI(e.player, new GUIFilterWhitelist(e.player)));
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
setOnPage(e -> draw());
|
||||
|
||||
AuctionHouse.newChain().asyncFirst(() -> {
|
||||
|
@ -30,10 +30,10 @@ import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.guis.confirmation.GUIListingConfirm;
|
||||
import ca.tweetzy.auctionhouse.helpers.AuctionCreator;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.helpers.MaterialCategorizer;
|
||||
import ca.tweetzy.auctionhouse.helpers.input.TitleInput;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.gui.GuiUtils;
|
||||
import ca.tweetzy.core.gui.events.GuiClickEvent;
|
||||
import ca.tweetzy.core.utils.NumberUtils;
|
||||
import ca.tweetzy.core.utils.PlayerUtils;
|
||||
@ -68,7 +68,7 @@ public final class GUISellAuction extends AbstractPlaceholderGui {
|
||||
this.allowBuyNow = allowBuyNow;
|
||||
|
||||
setTitle(Settings.GUI_SELL_AUCTION_TITLE.getString());
|
||||
setDefaultItem(GuiUtils.createButtonItem(Settings.GUI_SELL_AUCTION_BG_ITEM.getMaterial(), " "));
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_AUCTION_BG_ITEM.getString()));
|
||||
setRows(6);
|
||||
|
||||
setOnClose(close -> {
|
||||
|
@ -30,6 +30,7 @@ import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.guis.confirmation.GUIListingConfirm;
|
||||
import ca.tweetzy.auctionhouse.helpers.AuctionCreator;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.helpers.MaterialCategorizer;
|
||||
import ca.tweetzy.auctionhouse.helpers.input.TitleInput;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
@ -64,7 +65,7 @@ public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
this.allowPartialBuy = allowPartialBuy;
|
||||
|
||||
setTitle(Settings.GUI_SELL_BIN_TITLE.getString());
|
||||
setDefaultItem(GuiUtils.createButtonItem(Settings.GUI_SELL_BIN_BG_ITEM.getMaterial(), " "));
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_BIN_BG_ITEM.getString()));
|
||||
setRows(6);
|
||||
|
||||
setOnClose(close -> {
|
||||
|
@ -22,8 +22,8 @@ import ca.tweetzy.auctionhouse.ahv3.api.ListingType;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
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.core.gui.GuiUtils;
|
||||
import ca.tweetzy.flight.utils.QuickItem;
|
||||
import lombok.NonNull;
|
||||
|
||||
@ -40,7 +40,7 @@ public final class GUISellListingType extends AbstractPlaceholderGui {
|
||||
this.auctionPlayer = auctionPlayer;
|
||||
this.listingType = listingType;
|
||||
setTitle(Settings.GUI_SELL_LISTING_TYPE_TITLE.getString());
|
||||
setDefaultItem(GuiUtils.createButtonItem(Settings.GUI_SELL_LISTING_TYPE_BG_ITEM.getMaterial(), " "));
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_LISTING_TYPE_BG_ITEM.getString()));
|
||||
setRows(3);
|
||||
draw();
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
|
||||
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.gui.GuiUtils;
|
||||
import ca.tweetzy.core.utils.PlayerUtils;
|
||||
import ca.tweetzy.flight.utils.QuickItem;
|
||||
import lombok.NonNull;
|
||||
@ -51,7 +51,7 @@ public final class GUISellPlaceItem extends AbstractPlaceholderGui {
|
||||
this.viewMode = viewMode;
|
||||
this.listingType = listingType;
|
||||
setTitle(Settings.GUI_SELL_PLACE_ITEM_TITLE.getString());
|
||||
setDefaultItem(GuiUtils.createButtonItem(Settings.GUI_SELL_PLACE_ITEM_BG_ITEM.getMaterial(), " "));
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_PLACE_ITEM_BG_ITEM.getString()));
|
||||
setRows(viewMode == ViewMode.SINGLE_ITEM ? 4 : 6);
|
||||
|
||||
setAcceptsItems(true);
|
||||
|
@ -26,12 +26,14 @@ import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.managers.SoundManager;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.utils.items.TItemBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class GUIStatisticLeaderboard extends AbstractPlaceholderGui {
|
||||
@ -46,7 +48,7 @@ public final class GUIStatisticLeaderboard extends AbstractPlaceholderGui {
|
||||
this.auctionPlayer = player;
|
||||
this.statisticType = statisticType;
|
||||
setTitle(Settings.GUI_STATS_LEADERBOARD_TITLE.getString());
|
||||
setDefaultItem(Settings.GUI_STATS_LEADERBOARD_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_STATS_LEADERBOARD_BG_ITEM.getString()));
|
||||
setUseLockedCells(true);
|
||||
setAcceptsItems(false);
|
||||
setAllowDrops(false);
|
||||
@ -96,8 +98,8 @@ public final class GUIStatisticLeaderboard extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
private void drawPaginationButtons() {
|
||||
setPrevPage(5, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_BACK_BTN_NAME.getString()).setLore(Settings.GUI_BACK_BTN_LORE.getStringList()).toItemStack());
|
||||
setNextPage(5, 5, new TItemBuilder(Objects.requireNonNull(Settings.GUI_NEXT_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_NEXT_BTN_NAME.getString()).setLore(Settings.GUI_NEXT_BTN_LORE.getStringList()).toItemStack());
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
setOnPage(e -> {
|
||||
draw();
|
||||
SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString(), 1.0F, 1.0F);
|
||||
|
@ -36,7 +36,7 @@ public final class GUIStatisticSelf extends AbstractPlaceholderGui {
|
||||
super(player);
|
||||
this.auctionPlayer = player;
|
||||
setTitle(Settings.GUI_STATS_SELF_TITLE.getString());
|
||||
setDefaultItem(Settings.GUI_STATS_SELF_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_STATS_SELF_BG_ITEM.getString()));
|
||||
setUseLockedCells(true);
|
||||
setAcceptsItems(false);
|
||||
setAllowDrops(false);
|
||||
|
@ -38,7 +38,7 @@ public final class GUIStatisticTarget extends AbstractPlaceholderGui {
|
||||
this.auctionPlayer = player;
|
||||
this.targetPlayer = targetPlayer;
|
||||
setTitle(Settings.GUI_STATS_SEARCH_TITLE.getString().replace("%player_name%", targetPlayer.getPlayer().getName()));
|
||||
setDefaultItem(Settings.GUI_STATS_SEARCH_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_STATS_SEARCH_BG_ITEM.getString()));
|
||||
setUseLockedCells(true);
|
||||
setAcceptsItems(false);
|
||||
setAllowDrops(false);
|
||||
|
@ -34,7 +34,7 @@ public final class GUIStatisticViewSelect extends AbstractPlaceholderGui {
|
||||
super(player);
|
||||
this.auctionPlayer = player;
|
||||
setTitle(Settings.GUI_STATS_VIEW_SELECT_TITLE.getString());
|
||||
setDefaultItem(Settings.GUI_STATS_VIEW_SELECT_BG_ITEM.getMaterial().parseItem());
|
||||
getConfirmBuyNoItem()(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_STATS_VIEW_SELECT_BG_ITEM.getString()));
|
||||
setUseLockedCells(true);
|
||||
setAcceptsItems(false);
|
||||
setAllowDrops(false);
|
||||
|
@ -27,12 +27,14 @@ import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.auctionhouse.transaction.Transaction;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
import ca.tweetzy.core.utils.items.TItemBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -70,9 +72,9 @@ public class GUITransactionList extends AbstractPlaceholderGui {
|
||||
reset();
|
||||
|
||||
pages = (int) Math.max(1, Math.ceil(this.transactions.size() / (double) 45));
|
||||
setPrevPage(5, 3, new TItemBuilder(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_BACK_BTN_NAME.getString()).setLore(Settings.GUI_BACK_BTN_LORE.getStringList()).toItemStack());
|
||||
setButton(5, 4, new TItemBuilder(Objects.requireNonNull(Settings.GUI_REFRESH_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_REFRESH_BTN_NAME.getString()).setLore(Settings.GUI_REFRESH_BTN_LORE.getStringList()).toItemStack(), e -> e.manager.showGUI(e.player, new GUITransactionList(this.player, this.showAll)));
|
||||
setNextPage(5, 5, new TItemBuilder(Objects.requireNonNull(Settings.GUI_NEXT_BTN_ITEM.getMaterial().parseMaterial())).setName(Settings.GUI_NEXT_BTN_NAME.getString()).setLore(Settings.GUI_NEXT_BTN_LORE.getStringList()).toItemStack());
|
||||
setPrevPage(5, 3, getPreviousPageItem());
|
||||
setButton(5, 4, getRefreshButtonItem(), e -> e.manager.showGUI(e.player, new GUITransactionList(this.player, this.showAll)));
|
||||
setNextPage(5, 5, getNextPageItem());
|
||||
setOnPage(e -> draw());
|
||||
|
||||
// Other Buttons
|
||||
|
@ -52,7 +52,7 @@ public final class GUITransactionType extends AbstractPlaceholderGui {
|
||||
setRows(4);
|
||||
setAcceptsItems(false);
|
||||
setUseLockedCells(true);
|
||||
setDefaultItem(Settings.GUI_TRANSACTIONS_TYPE_BG_ITEM.getMaterial().parseItem());
|
||||
setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_TRANSACTIONS_TYPE_BG_ITEM.getString()));
|
||||
draw();
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class GUITransactionView extends AbstractPlaceholderGui {
|
||||
setTitle(TextUtils.formatText(Settings.GUI_TRANSACTION_VIEW_TITLE.getString()));
|
||||
setRows(6);
|
||||
setAcceptsItems(false);
|
||||
setDefaultItem(Settings.GUI_TRANSACTION_VIEW_BACKGROUND_ITEM.getMaterial().parseItem());
|
||||
getConfirmBuyNoItem()(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_TRANSACTION_VIEW_BACKGROUND_ITEM.getString()));
|
||||
setUseLockedCells(Settings.GUI_TRANSACTION_VIEW_BACKGROUND_FILL.getBoolean());
|
||||
|
||||
setButton(5, 0, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_CLOSE_BTN_ITEM.getString(), Settings.GUI_CLOSE_BTN_NAME.getString(), Settings.GUI_CLOSE_BTN_LORE.getStringList(), null), e -> e.manager.showGUI(e.player, new GUITransactionList(auctionPlayer.getPlayer(), showAll)));
|
||||
|
@ -27,6 +27,7 @@ import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -74,6 +75,10 @@ public class ConfigurationItemHelper {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack createConfigurationItem(String item) {
|
||||
return createConfigurationItem(item, " ", new ArrayList<>(), null);
|
||||
}
|
||||
|
||||
public static ItemStack createConfigurationItem(String item, String title, List<String> lore, HashMap<String, Object> replacements) {
|
||||
String[] split = item.split(":");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user