added placeholder support for all gui titles

Took 15 minutes
This commit is contained in:
Kiran Hart 2022-04-07 21:54:40 -04:00
parent 62c9f4632c
commit 51fc0dd3a4
27 changed files with 121 additions and 54 deletions

View File

@ -43,10 +43,7 @@ public class CommandAdmin extends AbstractCommand {
AuctionHouse.getInstance().getDataManager().getAdminLogs((error, logs) -> {
if (error == null)
AuctionHouse.newChain().sync(() -> {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIAdminLogs(logs));
}).execute();
AuctionHouse.newChain().sync(() -> AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIAdminLogs(player, logs))).execute();
else
error.printStackTrace();
});

View File

@ -37,7 +37,7 @@ public class CommandBan extends AbstractCommand {
if (args.length == 0) {
// Open the bans menu
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIBans());
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIBans(player));
return ReturnType.SUCCESS;
}

View File

@ -35,7 +35,7 @@ public class CommandFilter extends AbstractCommand {
if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
if (args.length == 0) {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIFilterWhitelist());
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIFilterWhitelist(player));
return ReturnType.SUCCESS;
}

View File

@ -33,7 +33,7 @@ public class CommandMinPrice extends AbstractCommand {
if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
if (args.length == 0) {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIMinItemPrices());
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIMinItemPrices(player));
return ReturnType.SUCCESS;
}

View File

@ -0,0 +1,33 @@
package ca.tweetzy.auctionhouse.guis;
import ca.tweetzy.auctionhouse.api.hook.PlaceholderAPIHook;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.core.gui.Gui;
import ca.tweetzy.core.utils.TextUtils;
import org.bukkit.entity.Player;
/**
* Date Created: April 07 2022
* Time Created: 9:33 p.m.
*
* @author Kiran Hart
*/
public abstract class AbstractPlaceholderGui extends Gui {
private final Player player;
public AbstractPlaceholderGui(Player player) {
this.player = player;
}
public AbstractPlaceholderGui(AuctionPlayer player) {
this.player = player.getPlayer();
}
@Override
public Gui setTitle(String message) {
super.setTitle(this.player == null ? TextUtils.formatText(message) : TextUtils.formatText(PlaceholderAPIHook.PAPIReplacer.tryReplace(this.player, message)));
return this;
}
}

View File

@ -25,7 +25,7 @@ import java.util.stream.Collectors;
* Time Created: 10:33 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIActiveAuctions extends Gui {
public class GUIActiveAuctions extends AbstractPlaceholderGui {
private final AuctionPlayer auctionPlayer;
private BukkitTask task;
@ -33,6 +33,7 @@ public class GUIActiveAuctions extends Gui {
private List<AuctionedItem> items;
public GUIActiveAuctions(AuctionPlayer auctionPlayer) {
super(auctionPlayer);
this.auctionPlayer = auctionPlayer;
setTitle(TextUtils.formatText(Settings.GUI_ACTIVE_AUCTIONS_TITLE.getString()));
setRows(6);

View File

@ -48,7 +48,7 @@ import java.util.stream.Collectors;
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIAuctionHouse extends Gui {
public class GUIAuctionHouse extends AbstractPlaceholderGui {
AuctionPlayer auctionPlayer;
private List<AuctionedItem> items;
@ -57,6 +57,7 @@ public class GUIAuctionHouse extends Gui {
private String searchPhrase = "";
public GUIAuctionHouse(AuctionPlayer auctionPlayer) {
super(auctionPlayer);
this.auctionPlayer = auctionPlayer;
setTitle(TextUtils.formatText(Settings.GUI_AUCTION_HOUSE_TITLE.getString()));
setRows(6);
@ -331,7 +332,7 @@ public class GUIAuctionHouse extends Gui {
if (NBTEditor.contains(clicked, "AuctionBundleItem")) {
cleanup();
e.manager.showGUI(e.player, new GUIContainerInspect(e.clickedItem));
e.manager.showGUI(e.player, new GUIContainerInspect(this.auctionPlayer, e.clickedItem));
return;
}
@ -342,7 +343,7 @@ public class GUIAuctionHouse extends Gui {
BlockStateMeta meta = (BlockStateMeta) clicked.getItemMeta();
if (!(meta.getBlockState() instanceof ShulkerBox)) return;
cleanup();
e.manager.showGUI(e.player, new GUIContainerInspect(e.clickedItem));
e.manager.showGUI(e.player, new GUIContainerInspect(this.auctionPlayer, e.clickedItem));
}
}

View File

@ -3,6 +3,7 @@ package ca.tweetzy.auctionhouse.guis;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.auction.AuctionBan;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.Gui;
@ -11,6 +12,7 @@ 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;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.scheduler.BukkitTask;
@ -26,12 +28,14 @@ import java.util.stream.Collectors;
* Time Created: 12:16 a.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIBans extends Gui {
public class GUIBans extends AbstractPlaceholderGui {
private List<AuctionBan> bans;
private BukkitTask task;
public GUIBans() {
public GUIBans(Player player) {
super(player);
setTitle(TextUtils.formatText(Settings.GUI_BANS_TITLE.getString()));
setDefaultItem(Settings.GUI_BANS_BG_ITEM.getMaterial().parseItem());
setUseLockedCells(true);

View File

@ -23,12 +23,13 @@ import org.bukkit.inventory.ItemStack;
* Time Created: 5:16 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIBid extends Gui {
public class GUIBid extends AbstractPlaceholderGui {
private final AuctionPlayer auctionPlayer;
private final AuctionedItem auctionItem;
public GUIBid(AuctionPlayer auctionPlayer, AuctionedItem auctionItem) {
super(auctionPlayer);
this.auctionPlayer = auctionPlayer;
this.auctionItem = auctionItem;
setTitle(TextUtils.formatText(Settings.GUI_BIDDING_TITLE.getString()));

View File

@ -23,9 +23,10 @@ import java.util.stream.Collectors;
* Time Created: 1:11 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public final class GUIBundleCreation extends Gui {
public final class GUIBundleCreation extends AbstractPlaceholderGui {
public GUIBundleCreation(AuctionPlayer player, int allowedTime, boolean buyNowAllow, boolean isBiddingItem, Double buyNowPrice, Double startingBid, Double bidIncrement) {
super(player);
setTitle(Settings.GUI_CREATE_BUNDLE_TITLE.getString());
setRows(6);
setAllowDrops(false);

View File

@ -27,7 +27,7 @@ import java.util.stream.Collectors;
* Time Created: 12:28 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIContainerInspect extends Gui {
public class GUIContainerInspect extends AbstractPlaceholderGui {
private final int[] fillSlots = {0, 1, 2, 3, 4, 5, 6, 7, 8, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 50, 51, 52, 53};
private final ItemStack container;
@ -43,7 +43,8 @@ public class GUIContainerInspect extends Gui {
*
* @param container is the shulker box
*/
public GUIContainerInspect(ItemStack container) {
public GUIContainerInspect(AuctionPlayer auctionPlayer, ItemStack container) {
super(auctionPlayer);
this.container = container;
this.fromPurchaseGUI = false;
setTitle(TextUtils.formatText(Settings.GUI_INSPECT_TITLE.getString()));
@ -74,7 +75,7 @@ public class GUIContainerInspect extends Gui {
}
public GUIContainerInspect(ItemStack container, AuctionPlayer auctionPlayer, AuctionedItem auctionItem, boolean buyingSpecificQuantity) {
this(container);
this(auctionPlayer, container);
this.auctionPlayer = auctionPlayer;
this.auctionItem = auctionItem;
this.buyingSpecificQuantity = buyingSpecificQuantity;

View File

@ -23,7 +23,7 @@ import java.util.stream.Collectors;
* Time Created: 3:19 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIExpiredItems extends Gui {
public class GUIExpiredItems extends AbstractPlaceholderGui {
final AuctionPlayer auctionPlayer;
@ -31,6 +31,7 @@ public class GUIExpiredItems extends Gui {
private Long lastClicked = null;
public GUIExpiredItems(AuctionPlayer auctionPlayer) {
super(auctionPlayer);
this.auctionPlayer = auctionPlayer;
setTitle(TextUtils.formatText(Settings.GUI_EXPIRED_AUCTIONS_TITLE.getString()));
setRows(6);

View File

@ -8,6 +8,7 @@ import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.Gui;
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;
@ -21,11 +22,12 @@ import java.util.stream.Collectors;
*
* @author Kiran Hart
*/
public final class GUIMinItemPrices extends Gui {
public final class GUIMinItemPrices extends AbstractPlaceholderGui {
final List<MinItemPrice> minPrices;
public GUIMinItemPrices() {
public GUIMinItemPrices(Player player) {
super(player);
this.minPrices = AuctionHouse.getInstance().getMinItemPriceManager().getMinPrices();
setTitle(TextUtils.formatText(Settings.GUI_MIN_ITEM_PRICES_TITLE.getString()));
setRows(6);
@ -54,7 +56,7 @@ public final class GUIMinItemPrices extends Gui {
}}), click -> {
AuctionHouse.getInstance().getDataManager().deleteMinItemPrice(Collections.singletonList(minItemPrice.getUuid()));
AuctionHouse.getInstance().getMinItemPriceManager().removeItem(minItemPrice);
click.manager.showGUI(click.player, new GUIMinItemPrices());
click.manager.showGUI(click.player, new GUIMinItemPrices(click.player));
});
}
}

View File

@ -30,7 +30,7 @@ import java.util.stream.Collectors;
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUISellItem extends Gui {
public class GUISellItem extends AbstractPlaceholderGui {
private final AuctionPlayer auctionPlayer;
private ItemStack itemToBeListed;
@ -44,6 +44,7 @@ public class GUISellItem extends Gui {
public GUISellItem(AuctionPlayer auctionPlayer, ItemStack itemToBeListed, double buyNowPrice, double bidStartPrice, double bidIncrementPrice, boolean isBiddingItem, boolean isAllowingBuyNow, int auctionTime) {
super(auctionPlayer);
this.auctionPlayer = auctionPlayer;
this.itemToBeListed = itemToBeListed;
this.buyNowPrice = buyNowPrice;

View File

@ -17,11 +17,12 @@ import java.util.HashMap;
* Time Created: 2:57 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public final class GUIStats extends Gui {
public final class GUIStats extends AbstractPlaceholderGui {
private final Player player;
public GUIStats(final Player player) {
super(player);
this.player = player;
setTitle(Settings.GUI_STATS_TITLE.getString());
setDefaultItem(Settings.GUI_STATS_BG_ITEM.getMaterial().parseItem());

View File

@ -7,6 +7,7 @@ import ca.tweetzy.auctionhouse.auction.AuctionAdminLog;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.AdminAction;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
@ -23,12 +24,13 @@ import org.bukkit.entity.Player;
* Time Created: 3:04 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIAdminItem extends Gui {
public class GUIAdminItem extends AbstractPlaceholderGui {
private final AuctionPlayer auctionPlayer;
private final AuctionedItem auctionItem;
public GUIAdminItem(AuctionPlayer auctionPlayer, AuctionedItem auctionItem) {
super(auctionPlayer);
this.auctionPlayer = auctionPlayer;
this.auctionItem = auctionItem;
setTitle(TextUtils.formatText(Settings.GUI_ITEM_ADMIN_TITLE.getString()));

View File

@ -2,11 +2,12 @@ package ca.tweetzy.auctionhouse.guis.admin;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.auction.AuctionAdminLog;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.Gui;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.core.utils.items.TItemBuilder;
import org.bukkit.entity.Player;
import java.util.Comparator;
import java.util.HashMap;
@ -20,11 +21,12 @@ import java.util.stream.Collectors;
* Time Created: 2:11 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public final class GUIAdminLogs extends Gui {
public final class GUIAdminLogs extends AbstractPlaceholderGui {
final List<AuctionAdminLog> logs;
public GUIAdminLogs(List<AuctionAdminLog> logs) {
public GUIAdminLogs(Player player, List<AuctionAdminLog> logs) {
super(player);
this.logs = logs;
setTitle(TextUtils.formatText(Settings.GUI_LOGS_TITLE.getString()));

View File

@ -5,6 +5,7 @@ import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.api.events.AuctionBidEvent;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.Gui;
@ -25,7 +26,7 @@ import java.util.Objects;
* Time Created: 11:18 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIConfirmBid extends Gui {
public class GUIConfirmBid extends AbstractPlaceholderGui {
private final AuctionPlayer auctionPlayer;
private final AuctionedItem auctionItem;
@ -37,6 +38,7 @@ public class GUIConfirmBid extends Gui {
}
public GUIConfirmBid(AuctionPlayer auctionPlayer, AuctionedItem auctionItem, double bidAmount) {
super(auctionPlayer);
this.auctionPlayer = auctionPlayer;
this.auctionItem = auctionItem;
this.bidAmount = bidAmount;

View File

@ -4,6 +4,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.guis.GUIActiveAuctions;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.Gui;
@ -19,12 +20,13 @@ import java.util.Objects;
* Time Created: 11:28 a.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIConfirmCancel extends Gui {
public class GUIConfirmCancel extends AbstractPlaceholderGui {
final AuctionPlayer auctionPlayer;
final AuctionedItem auctionItem;
public GUIConfirmCancel(AuctionPlayer auctionPlayer, AuctionedItem auctionItem) {
super(auctionPlayer);
this.auctionPlayer = auctionPlayer;
this.auctionItem = auctionItem;
setTitle(TextUtils.formatText(Settings.GUI_CONFIRM_CANCEL_TITLE.getString()));

View File

@ -1,6 +1,7 @@
package ca.tweetzy.auctionhouse.guis.confirmation;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.Gui;
import ca.tweetzy.core.utils.TextUtils;
@ -17,7 +18,7 @@ import java.util.Objects;
* Time Created: 11:18 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIConfirmListing extends Gui {
public class GUIConfirmListing extends AbstractPlaceholderGui {
private final Player player;
private final ItemStack originalItem;
@ -33,6 +34,7 @@ public class GUIConfirmListing extends Gui {
public GUIConfirmListing(Player player, ItemStack originalItem, ItemStack itemToSell, int allowedTime, double basePrice, double startingBid, double bidIncrement, boolean isBiddingItem, boolean bundle, boolean requiresHandRemove, boolean isInfinite) {
super(player);
this.player = player;
this.originalItem = originalItem;
this.itemToSell = itemToSell;

View File

@ -4,15 +4,15 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.api.events.AuctionEndEvent;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
import ca.tweetzy.auctionhouse.exception.ItemNotFoundException;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
import ca.tweetzy.auctionhouse.guis.GUIContainerInspect;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.managers.SoundManager;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.gui.Gui;
import ca.tweetzy.core.gui.events.GuiClickEvent;
import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.core.utils.PlayerUtils;
@ -35,7 +35,7 @@ import java.util.Objects;
* Time Created: 11:18 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIConfirmPurchase extends Gui {
public class GUIConfirmPurchase extends AbstractPlaceholderGui {
final AuctionPlayer auctionPlayer;
final AuctionedItem auctionItem;
@ -46,6 +46,7 @@ public class GUIConfirmPurchase extends Gui {
double pricePerItem = 0D;
public GUIConfirmPurchase(AuctionPlayer auctionPlayer, AuctionedItem auctionItem, boolean buyingSpecificQuantity) {
super(auctionPlayer);
this.auctionPlayer = auctionPlayer;
this.auctionItem = auctionItem;
this.buyingSpecificQuantity = buyingSpecificQuantity;

View File

@ -4,6 +4,7 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.auction.enums.AuctionItemCategory;
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;
@ -21,11 +22,12 @@ import java.util.HashMap;
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIFilterSelection extends Gui {
public class GUIFilterSelection extends AbstractPlaceholderGui {
final AuctionPlayer auctionPlayer;
public GUIFilterSelection(AuctionPlayer auctionPlayer) {
super(auctionPlayer);
this.auctionPlayer = auctionPlayer;
setTitle(TextUtils.formatText(Settings.GUI_FILTER_TITLE.getString()));
setRows(4);

View File

@ -1,10 +1,11 @@
package ca.tweetzy.auctionhouse.guis.filter;
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.gui.Gui;
import ca.tweetzy.core.utils.TextUtils;
import org.bukkit.entity.Player;
/**
* The current file has been created by Kiran Hart
@ -12,9 +13,10 @@ import ca.tweetzy.core.utils.TextUtils;
* Time Created: 3:14 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIFilterWhitelist extends Gui {
public class GUIFilterWhitelist extends AbstractPlaceholderGui {
public GUIFilterWhitelist() {
public GUIFilterWhitelist(Player player) {
super(player);
setTitle(TextUtils.formatText(Settings.GUI_FILTER_WHITELIST_TITLE.getString()));
setRows(6);
setAcceptsItems(false);
@ -25,37 +27,37 @@ public class GUIFilterWhitelist extends Gui {
private void draw() {
setButton(2, 1, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILTER_WHITELIST_ITEMS_BLOCKS_ITEM.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_BLOCKS_NAME.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_BLOCKS_LORE.getStringList(), null), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(AuctionItemCategory.BLOCKS));
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.BLOCKS));
});
setButton(2, 3, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILTER_WHITELIST_ITEMS_FOOD_ITEM.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_FOOD_NAME.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_FOOD_LORE.getStringList(), null), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(AuctionItemCategory.FOOD));
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.FOOD));
});
setButton(2, 5, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILTER_WHITELIST_ITEMS_ARMOR_ITEM.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_ARMOR_NAME.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_ARMOR_LORE.getStringList(), null), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(AuctionItemCategory.ARMOR));
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.ARMOR));
});
setButton(2, 7, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILTER_WHITELIST_ITEMS_TOOLS_ITEM.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_TOOLS_NAME.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_TOOLS_LORE.getStringList(), null), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(AuctionItemCategory.TOOLS));
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.TOOLS));
});
// 2ND ROW STARTS
setButton(3, 1, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILTER_WHITELIST_ITEMS_SPAWNERS_ITEM.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_SPAWNERS_NAME.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_SPAWNERS_LORE.getStringList(), null), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(AuctionItemCategory.SPAWNERS));
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.SPAWNERS));
});
setButton(3, 3, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILTER_WHITELIST_ITEMS_ENCHANTS_ITEM.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_ENCHANTS_NAME.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_ENCHANTS_LORE.getStringList(), null), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(AuctionItemCategory.ENCHANTS));
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.ENCHANTS));
});
setButton(3, 5, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILTER_WHITELIST_ITEMS_WEAPONS_ITEM.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_WEAPONS_NAME.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_WEAPONS_LORE.getStringList(), null), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(AuctionItemCategory.WEAPONS));
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.WEAPONS));
});
setButton(3, 7, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_ITEM.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_NAME.getString(), Settings.GUI_FILTER_WHITELIST_ITEMS_MISC_LORE.getStringList(), null), e -> {
e.manager.showGUI(e.player, new GUIFilterWhitelistList(AuctionItemCategory.MISC));
e.manager.showGUI(e.player, new GUIFilterWhitelistList(e.player, AuctionItemCategory.MISC));
});
}
}

View File

@ -3,10 +3,11 @@ package ca.tweetzy.auctionhouse.guis.filter;
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.settings.Settings;
import ca.tweetzy.core.gui.Gui;
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;
@ -20,12 +21,13 @@ import java.util.stream.Collectors;
* Time Created: 4:06 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUIFilterWhitelistList extends Gui {
public class GUIFilterWhitelistList extends AbstractPlaceholderGui {
final AuctionItemCategory filerCategory;
List<AuctionFilterItem> items;
public GUIFilterWhitelistList(AuctionItemCategory filerCategory) {
public GUIFilterWhitelistList(Player player, AuctionItemCategory filerCategory) {
super(player);
this.filerCategory = filerCategory;
setTitle(TextUtils.formatText(Settings.GUI_FILTER_WHITELIST_LIST_TITLE.getString().replace("%filter_category%", filerCategory.getTranslatedType())));
setRows(6);
@ -34,13 +36,13 @@ public class GUIFilterWhitelistList extends Gui {
setUseLockedCells(true);
draw();
setOnClose(close -> close.manager.showGUI(close.player, new GUIFilterWhitelist()));
setOnClose(close -> close.manager.showGUI(close.player, new GUIFilterWhitelist(close.player)));
}
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()));
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());
setOnPage(e -> draw());

View File

@ -3,6 +3,7 @@ package ca.tweetzy.auctionhouse.guis.transaction;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
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;
@ -22,7 +23,7 @@ import java.util.stream.Collectors;
* Time Created: 7:03 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUITransactionList extends Gui {
public class GUITransactionList extends AbstractPlaceholderGui {
final List<Transaction> transactions;
final AuctionPlayer auctionPlayer;
@ -31,6 +32,7 @@ public class GUITransactionList extends Gui {
public GUITransactionList(Player player, boolean showAll) {
super(player);
this.player = player;
this.auctionPlayer = AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(this.player.getUniqueId());
this.showAll = showAll;

View File

@ -2,6 +2,7 @@ package ca.tweetzy.auctionhouse.guis.transaction;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
@ -23,11 +24,12 @@ import java.util.*;
* Time Created: 5:32 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public final class GUITransactionType extends Gui {
public final class GUITransactionType extends AbstractPlaceholderGui {
private final Player player;
public GUITransactionType(Player player) {
super(player);
this.player = player;
setTitle(TextUtils.formatText(Settings.GUI_TRANSACTIONS_TYPE_TITLE.getString()));
setRows(4);

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.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.auctionhouse.transaction.Transaction;
@ -21,9 +22,10 @@ import java.util.stream.Collectors;
* Time Created: 7:04 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class GUITransactionView extends Gui {
public class GUITransactionView extends AbstractPlaceholderGui {
public GUITransactionView(AuctionPlayer auctionPlayer, Transaction transaction, boolean showAll) {
super(auctionPlayer);
setTitle(TextUtils.formatText(Settings.GUI_TRANSACTION_VIEW_TITLE.getString()));
setRows(6);
setAcceptsItems(false);