mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-01-07 12:47:36 +01:00
⬅️➡️ Added unique button for actual back navigation (back to another gui not prev page). Closes #51
Took 11 minutes
This commit is contained in:
parent
302f3d76dd
commit
24f1d9430a
@ -55,12 +55,16 @@ public abstract class AbstractPlaceholderGui extends Gui {
|
||||
return this;
|
||||
}
|
||||
|
||||
protected ItemStack getPreviousPageItem() {
|
||||
protected ItemStack getBackButtonItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_BACK_BTN_ITEM.getString(), Settings.GUI_BACK_BTN_NAME.getString(), Settings.GUI_BACK_BTN_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getPreviousPageItem() {
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_PREV_PAGE_BTN_ITEM.getString(), Settings.GUI_PREV_PAGE_BTN_NAME.getString(), Settings.GUI_PREV_PAGE_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);
|
||||
return ConfigurationItemHelper.createConfigurationItem(Settings.GUI_NEXT_PAGE_BTN_ITEM.getString(), Settings.GUI_NEXT_PAGE_BTN_NAME.getString(), Settings.GUI_NEXT_PAGE_BTN_LORE.getStringList(), null);
|
||||
}
|
||||
|
||||
protected ItemStack getRefreshButtonItem() {
|
||||
|
@ -138,7 +138,7 @@ public class GUIActiveAuctions extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
private void drawFixedButtons() {
|
||||
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 -> {
|
||||
setButton(5, 0, getBackButtonItem(), e -> {
|
||||
cleanup();
|
||||
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
|
||||
});
|
||||
|
@ -22,7 +22,6 @@ import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
|
||||
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
|
||||
import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType;
|
||||
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
|
||||
import ca.tweetzy.auctionhouse.managers.SoundManager;
|
||||
import ca.tweetzy.auctionhouse.settings.Settings;
|
||||
import ca.tweetzy.core.utils.TextUtils;
|
||||
@ -79,7 +78,7 @@ public class GUIActiveBids extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
private void drawFixedButtons() {
|
||||
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 -> {
|
||||
setButton(5, 0, getBackButtonItem(), e -> {
|
||||
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
|
||||
});
|
||||
|
||||
|
@ -530,8 +530,8 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
private void drawPaginationButtons() {
|
||||
setPrevPage(Settings.GUI_BACK_BTN_SLOT.getInt(), getPreviousPageItem());
|
||||
setNextPage(Settings.GUI_NEXT_BTN_SLOT.getInt(), getNextPageItem());
|
||||
setPrevPage(Settings.GUI_PREV_PAGE_BTN_SLOT.getInt(), getPreviousPageItem());
|
||||
setNextPage(Settings.GUI_NEXT_PAGE_BTN_SLOT.getInt(), getNextPageItem());
|
||||
|
||||
setOnPage(e -> {
|
||||
draw();
|
||||
|
@ -110,7 +110,7 @@ public class GUIContainerInspect extends AbstractPlaceholderGui {
|
||||
for (int i : fillSlots) setItem(i, getDefaultItem());
|
||||
|
||||
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 -> {
|
||||
setButton(5, 4, getBackButtonItem(), e -> {
|
||||
if (fromPurchaseGUI) {
|
||||
AuctionHouse.getInstance().getTransactionManager().addPrePurchase(e.player, auctionItem.getId());
|
||||
e.manager.showGUI(e.player, new GUIConfirmPurchase(this.auctionPlayer, this.auctionItem, this.buyingSpecificQuantity));
|
||||
|
@ -64,7 +64,7 @@ public class GUIExpiredItems extends AbstractPlaceholderGui {
|
||||
private void draw() {
|
||||
reset();
|
||||
|
||||
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 GUIAuctionHouse(this.auctionPlayer)));
|
||||
setButton(5, 0, getBackButtonItem(), e -> e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer)));
|
||||
|
||||
AuctionHouse.newChain().asyncFirst(() -> {
|
||||
this.items = this.auctionPlayer.getItems(true);
|
||||
|
@ -65,7 +65,7 @@ public class GUIPaymentCollection extends AbstractPlaceholderGui {
|
||||
|
||||
private void draw() {
|
||||
reset();
|
||||
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 GUIExpiredItems(this.auctionPlayer)));
|
||||
setButton(5, 0, getBackButtonItem(), e -> e.manager.showGUI(e.player, new GUIExpiredItems(this.auctionPlayer)));
|
||||
|
||||
AuctionHouse.newChain().asyncFirst(() -> {
|
||||
this.payments = AuctionHouse.getInstance().getPaymentsManager().getPaymentsByPlayer(this.player);
|
||||
|
@ -84,7 +84,7 @@ public final class GUISellAuction extends AbstractPlaceholderGui {
|
||||
private void draw() {
|
||||
reset();
|
||||
|
||||
setButton(getRows() - 1, 0, getPreviousPageItem(), click -> {
|
||||
setButton(getRows() - 1, 0, getBackButtonItem(), 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));
|
||||
|
@ -81,7 +81,7 @@ public final class GUISellBin extends AbstractPlaceholderGui {
|
||||
private void draw() {
|
||||
reset();
|
||||
|
||||
setButton(getRows() - 1, 0, getPreviousPageItem(), click -> {
|
||||
setButton(getRows() - 1, 0, getBackButtonItem(), 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));
|
||||
|
@ -70,7 +70,7 @@ public final class GUISellPlaceItem extends AbstractPlaceholderGui {
|
||||
|
||||
private void draw() {
|
||||
|
||||
setButton(getRows() - 1, 0, getCloseButtonItem(), click -> {
|
||||
setButton(getRows() - 1, 0, getBackButtonItem(), click -> {
|
||||
|
||||
if (click.cursor.getType() == Material.AIR) {
|
||||
click.gui.close();
|
||||
|
@ -90,7 +90,7 @@ public final class GUIStatisticLeaderboard extends AbstractPlaceholderGui {
|
||||
}
|
||||
}).execute();
|
||||
|
||||
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 -> {
|
||||
setButton(5, 0, getBackButtonItem(), e -> {
|
||||
e.manager.showGUI(e.player, new GUIStatisticViewSelect(this.auctionPlayer));
|
||||
});
|
||||
|
||||
|
@ -77,7 +77,7 @@ public final class GUIStatisticSelf extends AbstractPlaceholderGui {
|
||||
put("%money_spent%", AuctionAPI.getInstance().formatNumber(instance.getAuctionStatisticManager().getStatisticByPlayer(player.getUniqueId(), AuctionStatisticType.MONEY_SPENT)));
|
||||
}}));
|
||||
|
||||
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 -> {
|
||||
setButton(5, 4, getBackButtonItem(), e -> {
|
||||
e.manager.showGUI(e.player, new GUIStatisticViewSelect(this.auctionPlayer));
|
||||
});
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class GUITransactionList extends AbstractPlaceholderGui {
|
||||
setOnPage(e -> draw());
|
||||
|
||||
// Other Buttons
|
||||
setButton(5, 0, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_BACK_BTN_ITEM.getString(), Settings.GUI_BACK_BTN_NAME.getString(), Settings.GUI_BACK_BTN_LORE.getStringList(), null), e -> {
|
||||
setButton(5, 0, getBackButtonItem(), e -> {
|
||||
if (Settings.RESTRICT_ALL_TRANSACTIONS_TO_PERM.getBoolean() && !e.player.hasPermission("auctionhouse.transactions.viewall")) {
|
||||
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
|
||||
} else {
|
||||
|
@ -122,6 +122,6 @@ public final class GUITransactionType extends AbstractPlaceholderGui {
|
||||
});
|
||||
}
|
||||
|
||||
setButton(3, 0, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_BACK_BTN_ITEM.getString(), Settings.GUI_BACK_BTN_NAME.getString(), Settings.GUI_BACK_BTN_LORE.getStringList(), null), e -> e.manager.showGUI(e.player, new GUIAuctionHouse(AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(e.player.getUniqueId()))));
|
||||
setButton(3, 0, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_PREV_PAGE_BTN_ITEM.getString(), Settings.GUI_PREV_PAGE_BTN_NAME.getString(), Settings.GUI_PREV_PAGE_BTN_LORE.getStringList(), null), e -> e.manager.showGUI(e.player, new GUIAuctionHouse(AuctionHouse.getInstance().getAuctionPlayerManager().getPlayer(e.player.getUniqueId()))));
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class GUITransactionView extends AbstractPlaceholderGui {
|
||||
setDefaultItem(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)));
|
||||
setButton(5, 0, getBackButtonItem(), e -> e.manager.showGUI(e.player, new GUITransactionList(auctionPlayer.getPlayer(), showAll)));
|
||||
setItem(1, 4, transaction.getItem());
|
||||
|
||||
setItem(3, 2, GuiUtils.createButtonItem(AuctionAPI.getInstance().getPlayerHead(Bukkit.getOfflinePlayer(transaction.getSeller()).getName()), TextUtils.formatText(Settings.GUI_TRANSACTION_VIEW_ITEM_SELLER_NAME.getString().replace("%seller_name%", Bukkit.getOfflinePlayer(transaction.getSeller()).getName())),
|
||||
|
@ -436,20 +436,24 @@ public class Settings {
|
||||
|
||||
public static final ConfigSetting GUI_FILLER = new ConfigSetting(config, "gui.filler item", CompMaterial.BLACK_STAINED_GLASS_PANE.name(), "An item to be used to fill empty gui slots, this will be", "removed in later versions to be done on a per gui basis");
|
||||
|
||||
|
||||
public static final ConfigSetting GUI_BACK_BTN_SLOT = new ConfigSetting(config, "gui.global items.back button.slot", 48, "Valid Slots: 45 - 53");
|
||||
public static final ConfigSetting GUI_BACK_BTN_ITEM = new ConfigSetting(config, "gui.global items.back button.item", "ARROW", "Settings for the back button");
|
||||
public static final ConfigSetting GUI_BACK_BTN_NAME = new ConfigSetting(config, "gui.global items.back button.name", "&e<< Back");
|
||||
public static final ConfigSetting GUI_BACK_BTN_ITEM = new ConfigSetting(config, "gui.global items.back button.item", "ARROW", "Settings for the previous page button");
|
||||
public static final ConfigSetting GUI_BACK_BTN_NAME = new ConfigSetting(config, "gui.global items.back button.name", "&e<< Previous Page");
|
||||
public static final ConfigSetting GUI_BACK_BTN_LORE = new ConfigSetting(config, "gui.global items.back button.lore", Arrays.asList("&7Click the button to go", "&7back to the previous page."));
|
||||
|
||||
|
||||
public static final ConfigSetting GUI_PREV_PAGE_BTN_SLOT = new ConfigSetting(config, "gui.global items.previous page button.slot", 48, "Valid Slots: 45 - 53");
|
||||
public static final ConfigSetting GUI_PREV_PAGE_BTN_ITEM = new ConfigSetting(config, "gui.global items.previous page button.item", "ARROW", "Settings for the previous page button");
|
||||
public static final ConfigSetting GUI_PREV_PAGE_BTN_NAME = new ConfigSetting(config, "gui.global items.previous page button.name", "&e<< Previous Page");
|
||||
public static final ConfigSetting GUI_PREV_PAGE_BTN_LORE = new ConfigSetting(config, "gui.global items.previous page button.lore", Arrays.asList("&7Click the button to go", "&7back to the previous page."));
|
||||
|
||||
public static final ConfigSetting GUI_CLOSE_BTN_ITEM = new ConfigSetting(config, "gui.global items.close button.item", "BARRIER", "Settings for the close button");
|
||||
public static final ConfigSetting GUI_CLOSE_BTN_NAME = new ConfigSetting(config, "gui.global items.close button.name", "&cClose");
|
||||
public static final ConfigSetting GUI_CLOSE_BTN_LORE = new ConfigSetting(config, "gui.global items.close button.lore", Collections.singletonList("&7Click to close this menu."));
|
||||
|
||||
public static final ConfigSetting GUI_NEXT_BTN_SLOT = new ConfigSetting(config, "gui.global items.next button.slot", 50, "Valid Slots: 45 - 53");
|
||||
public static final ConfigSetting GUI_NEXT_BTN_ITEM = new ConfigSetting(config, "gui.global items.next button.item", "ARROW", "Settings for the next button");
|
||||
public static final ConfigSetting GUI_NEXT_BTN_NAME = new ConfigSetting(config, "gui.global items.next button.name", "&eNext >>");
|
||||
public static final ConfigSetting GUI_NEXT_BTN_LORE = new ConfigSetting(config, "gui.global items.next button.lore", Arrays.asList("&7Click the button to go", "&7to the next page."));
|
||||
public static final ConfigSetting GUI_NEXT_PAGE_BTN_SLOT = new ConfigSetting(config, "gui.global items.next page button.slot", 50, "Valid Slots: 45 - 53");
|
||||
public static final ConfigSetting GUI_NEXT_PAGE_BTN_ITEM = new ConfigSetting(config, "gui.global items.next page button.item", "ARROW", "Settings for the next button");
|
||||
public static final ConfigSetting GUI_NEXT_PAGE_BTN_NAME = new ConfigSetting(config, "gui.global items.next page button.name", "&eNext Page >>");
|
||||
public static final ConfigSetting GUI_NEXT_PAGE_BTN_LORE = new ConfigSetting(config, "gui.global items.next page button.lore", Arrays.asList("&7Click the button to go", "&7to the next page."));
|
||||
|
||||
public static final ConfigSetting GUI_REFRESH_BTN_ENABLED = new ConfigSetting(config, "gui.global items.refresh button.enabled", true);
|
||||
public static final ConfigSetting GUI_REFRESH_BTN_SLOT = new ConfigSetting(config, "gui.global items.refresh button.slot", 49, "Valid Slots: 45 - 53");
|
||||
|
Loading…
Reference in New Issue
Block a user