From 36a7c9efd3f61ccaab7fb0208d795760ef551ada Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Sat, 4 Feb 2023 13:15:55 -0500 Subject: [PATCH] audio levels, use new quickitem model data of(string), seperate title for bundle listing palce items, simple compare for min item prices Took 19 minutes --- pom.xml | 4 ++-- .../auctionhouse/guis/GUIActiveAuctions.java | 2 +- .../auctionhouse/guis/GUIAuctionHouse.java | 2 +- .../auctionhouse/guis/GUIExpiredItems.java | 2 +- .../guis/confirmation/GUIConfirmPurchase.java | 2 +- .../guis/sell/GUISellAuction.java | 15 +++++++-------- .../auctionhouse/guis/sell/GUISellBin.java | 12 +++++------- .../guis/sell/GUISellListingType.java | 7 +++---- .../guis/sell/GUISellPlaceItem.java | 7 +++---- .../statistics/GUIStatisticLeaderboard.java | 2 +- .../auctionhouse/helpers/AuctionCreator.java | 2 +- .../managers/MinItemPriceManager.java | 18 ++++++++++++++++++ .../auctionhouse/managers/SoundManager.java | 19 +++---------------- .../auctionhouse/settings/Settings.java | 6 +++++- 14 files changed, 52 insertions(+), 48 deletions(-) diff --git a/pom.xml b/pom.xml index 4b2b05d..b519a28 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ AuctionHouse The ultimate auction solution for your server - 2.82.1 + 2.82.2 jar @@ -16,7 +16,7 @@ ${project.name} ${project.groupId}.${project.artifactId}.${project.name} 8 - 3.8.0 + 3.10.0 ca.tweetzy UTF-8 diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java index 722c656..a567d4c 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIActiveAuctions.java @@ -147,7 +147,7 @@ public class GUIActiveAuctions extends AbstractPlaceholderGui { setNextPage(5, 5, getNextPageItem()); setOnPage(e -> { draw(); - SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString(), 1.0F, 1.0F); + SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString()); }); } diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java index bd9d37f..5dcfe89 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java @@ -507,7 +507,7 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui { setOnPage(e -> { draw(); - SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString(), 1.0F, 1.0F); + SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString()); }); } diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIExpiredItems.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIExpiredItems.java index 3f51dc2..b3fc121 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIExpiredItems.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIExpiredItems.java @@ -81,7 +81,7 @@ public class GUIExpiredItems extends AbstractPlaceholderGui { setNextPage(5, 5, getNextPageItem()); setOnPage(e -> { draw(); - SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString(), 1.0F, 1.0F); + SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString()); }); diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmPurchase.java b/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmPurchase.java index 1b8193e..feaec6a 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmPurchase.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/confirmation/GUIConfirmPurchase.java @@ -138,7 +138,7 @@ public class GUIConfirmPurchase extends AbstractPlaceholderGui { // Check economy if (!EconomyManager.hasBalance(e.player, buyNowPrice + (Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? tax : 0D))) { AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(e.player); - SoundManager.getInstance().playSound(e.player, Settings.SOUNDS_NOT_ENOUGH_MONEY.getString(), 1.0F, 1.0F); + SoundManager.getInstance().playSound(e.player, Settings.SOUNDS_NOT_ENOUGH_MONEY.getString()); e.gui.close(); return; } diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellAuction.java b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellAuction.java index dea87d1..d8529ad 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellAuction.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellAuction.java @@ -45,7 +45,6 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; import java.util.Arrays; -import java.util.Objects; import java.util.UUID; public final class GUISellAuction extends AbstractPlaceholderGui { @@ -87,7 +86,7 @@ public final class GUISellAuction extends AbstractPlaceholderGui { reset(); setButton(getRows() - 1, 0, QuickItem - .of(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseItem())) + .of(Settings.GUI_BACK_BTN_ITEM.getString()) .name(Settings.GUI_BACK_BTN_NAME.getString()) .lore(Settings.GUI_BACK_BTN_LORE.getStringList()) .make(), click -> { @@ -101,7 +100,7 @@ public final class GUISellAuction extends AbstractPlaceholderGui { final long[] times = AuctionAPI.getInstance().getRemainingTimeValues(this.listingTime); setButton(3, 1, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_ITEM.getMaterial().parseItem())) + .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(), @@ -153,7 +152,7 @@ public final class GUISellAuction extends AbstractPlaceholderGui { if (Settings.ALLOW_USAGE_OF_BUY_NOW_SYSTEM.getBoolean()) setButton(3, 4, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_PRICE_ITEM.getMaterial().parseItem())) + .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 -> { @@ -197,7 +196,7 @@ public final class GUISellAuction extends AbstractPlaceholderGui { }); setButton(3, 3, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_STARTING_PRICE_ITEM.getMaterial().parseItem())) + .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 -> { @@ -247,7 +246,7 @@ public final class GUISellAuction extends AbstractPlaceholderGui { }); setButton(3, 5, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_INCREMENT_PRICE_ITEM.getMaterial().parseItem())) + .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 -> { @@ -294,7 +293,7 @@ public final class GUISellAuction extends AbstractPlaceholderGui { drawBuyoutToggle(); setButton(getRows() - 1, 4, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_CONTINUE_ITEM.getMaterial().parseItem())) + .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 -> { @@ -324,7 +323,7 @@ public final class GUISellAuction extends AbstractPlaceholderGui { private void drawBuyoutToggle() { if (Settings.ALLOW_USAGE_OF_BUY_NOW_SYSTEM.getBoolean()) { setButton(3, 7, QuickItem - .of(Objects.requireNonNull(this.allowBuyNow ? Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_ENABLED_ITEM.getMaterial().parseItem() : Settings.GUI_SELL_AUCTION_ITEM_ITEMS_BUYOUT_DISABLED_ITEM.getMaterial().parseItem())) + .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 -> { diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellBin.java b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellBin.java index 77b8ffb..ed6c150 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellBin.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellBin.java @@ -34,7 +34,6 @@ 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; @@ -46,7 +45,6 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; import java.util.Arrays; -import java.util.Objects; import java.util.UUID; public final class GUISellBin extends AbstractPlaceholderGui { @@ -84,7 +82,7 @@ public final class GUISellBin extends AbstractPlaceholderGui { reset(); setButton(getRows() - 1, 0, QuickItem - .of(Objects.requireNonNull(Settings.GUI_BACK_BTN_ITEM.getMaterial().parseItem())) + .of(Settings.GUI_BACK_BTN_ITEM.getString()) .name(Settings.GUI_BACK_BTN_NAME.getString()) .lore(Settings.GUI_BACK_BTN_LORE.getStringList()) .make(), click -> { @@ -98,7 +96,7 @@ public final class GUISellBin extends AbstractPlaceholderGui { final long[] times = AuctionAPI.getInstance().getRemainingTimeValues(this.listingTime); setButton(3, 1, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_ITEM.getMaterial().parseItem())) + .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(), @@ -142,7 +140,7 @@ public final class GUISellBin extends AbstractPlaceholderGui { } setButton(3, 4, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_BIN_ITEM_ITEMS_PRICE_ITEM.getMaterial().parseItem())) + .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 -> { @@ -183,7 +181,7 @@ public final class GUISellBin extends AbstractPlaceholderGui { setItem(1, 4, createListingItem().getDisplayStack(AuctionStackType.LISTING_PREVIEW)); setButton(getRows() - 1, 4, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_BIN_ITEM_ITEMS_CONTINUE_ITEM.getMaterial().parseItem())) + .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 -> { @@ -227,7 +225,7 @@ public final class GUISellBin extends AbstractPlaceholderGui { private void drawQtyPurchase() { if (Settings.ALLOW_PURCHASE_OF_SPECIFIC_QUANTITIES.getBoolean()) { setButton(3, 7, QuickItem - .of(Objects.requireNonNull(this.allowPartialBuy ? Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_ENABLED_ITEM.getMaterial().parseItem() : Settings.GUI_SELL_BIN_ITEM_ITEMS_PARTIAL_DISABLED_ITEM.getMaterial().parseItem())) + .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 -> { diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellListingType.java b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellListingType.java index 2ce3500..afa58de 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellListingType.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellListingType.java @@ -27,7 +27,6 @@ import ca.tweetzy.auctionhouse.settings.Settings; import ca.tweetzy.flight.utils.QuickItem; import lombok.NonNull; -import java.util.Objects; import java.util.function.Consumer; public final class GUISellListingType extends AbstractPlaceholderGui { @@ -58,7 +57,7 @@ public final class GUISellListingType extends AbstractPlaceholderGui { } setButton(getRows() - 1, 0, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_LISTING_TYPE_ITEMS_RETURN_ITEM.getMaterial().parseItem())) + .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))); @@ -66,7 +65,7 @@ public final class GUISellListingType extends AbstractPlaceholderGui { private void drawAuctionButton(int col) { setButton(1, col, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_LISTING_TYPE_ITEMS_AUCTION_ITEM.getMaterial().parseItem())) + .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 -> { @@ -78,7 +77,7 @@ public final class GUISellListingType extends AbstractPlaceholderGui { private void drawBinButton(int col) { setButton(1, col, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_LISTING_TYPE_ITEMS_BIN_ITEM.getMaterial().parseItem())) + .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 -> { diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellPlaceItem.java b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellPlaceItem.java index 0fae444..196560c 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellPlaceItem.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/sell/GUISellPlaceItem.java @@ -32,7 +32,6 @@ import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import java.util.ArrayList; -import java.util.Objects; public final class GUISellPlaceItem extends AbstractPlaceholderGui { @@ -50,7 +49,7 @@ public final class GUISellPlaceItem extends AbstractPlaceholderGui { this.auctionPlayer = auctionPlayer; this.viewMode = viewMode; this.listingType = listingType; - setTitle(Settings.GUI_SELL_PLACE_ITEM_TITLE.getString()); + setTitle(viewMode == ViewMode.SINGLE_ITEM ? Settings.GUI_SELL_PLACE_ITEM_TITLE.getString() : Settings.GUI_SELL_PLACE_ITEM_BUNDLE_TITLE.getString()); setDefaultItem(ConfigurationItemHelper.createConfigurationItem(Settings.GUI_SELL_PLACE_ITEM_BG_ITEM.getString())); setRows(viewMode == ViewMode.SINGLE_ITEM ? 4 : 6); @@ -72,7 +71,7 @@ public final class GUISellPlaceItem extends AbstractPlaceholderGui { private void draw() { setButton(getRows() - 1, 0, QuickItem - .of(Objects.requireNonNull(Settings.GUI_CLOSE_BTN_ITEM.getMaterial().parseItem())) + .of(Settings.GUI_CLOSE_BTN_ITEM.getString()) .name(Settings.GUI_CLOSE_BTN_NAME.getString()) .lore(Settings.GUI_CLOSE_BTN_LORE.getStringList()) .make(), click -> { @@ -84,7 +83,7 @@ public final class GUISellPlaceItem extends AbstractPlaceholderGui { }); setButton(getRows() - 1, 4, QuickItem - .of(Objects.requireNonNull(Settings.GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_ITEM.getMaterial().parseItem())) + .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 -> { diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/statistics/GUIStatisticLeaderboard.java b/src/main/java/ca/tweetzy/auctionhouse/guis/statistics/GUIStatisticLeaderboard.java index 3accd5c..15fde8e 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/guis/statistics/GUIStatisticLeaderboard.java +++ b/src/main/java/ca/tweetzy/auctionhouse/guis/statistics/GUIStatisticLeaderboard.java @@ -102,7 +102,7 @@ public final class GUIStatisticLeaderboard extends AbstractPlaceholderGui { setNextPage(5, 5, getNextPageItem()); setOnPage(e -> { draw(); - SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString(), 1.0F, 1.0F); + SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString()); }); } diff --git a/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java b/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java index 1b8388a..aeb5f8d 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java +++ b/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java @@ -124,7 +124,7 @@ public final class AuctionCreator { // A VERY UGLY LISTING MESSAGING THING, IDEK, I GOTTA DEAL WITH THIS EVENTUALLY 💀 - SoundManager.getInstance().playSound(seller, Settings.SOUNDS_LISTED_ITEM_ON_AUCTION_HOUSE.getString(), 1.0F, 1.0F); + SoundManager.getInstance().playSound(seller, Settings.SOUNDS_LISTED_ITEM_ON_AUCTION_HOUSE.getString()); String NAX = AuctionHouse.getInstance().getLocale().getMessage("auction.biditemwithdisabledbuynow").getMessage(); String msg = AuctionHouse.getInstance().getLocale().getMessage(auctionItem.isBidItem() ? "auction.listed.withbid" : "auction.listed.nobid") .processPlaceholder("amount", finalItemToSell.getAmount()) diff --git a/src/main/java/ca/tweetzy/auctionhouse/managers/MinItemPriceManager.java b/src/main/java/ca/tweetzy/auctionhouse/managers/MinItemPriceManager.java index db1e231..e61e15d 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/managers/MinItemPriceManager.java +++ b/src/main/java/ca/tweetzy/auctionhouse/managers/MinItemPriceManager.java @@ -20,6 +20,8 @@ package ca.tweetzy.auctionhouse.managers; import ca.tweetzy.auctionhouse.AuctionHouse; import ca.tweetzy.auctionhouse.auction.MinItemPrice; +import ca.tweetzy.auctionhouse.settings.Settings; +import ca.tweetzy.flight.comp.enums.ServerVersion; import org.bukkit.inventory.ItemStack; import java.util.ArrayList; @@ -46,9 +48,25 @@ public final class MinItemPriceManager { } public MinItemPrice getMinPrice(ItemStack item) { + if (Settings.MIN_ITEM_PRICE_USES_SIMPE_COMPARE.getBoolean()) + return this.minPrices.stream().filter(mins -> simpleMatching(mins, item)).findFirst().orElse(null); + return this.minPrices.stream().filter(mins -> mins.getItemStack().isSimilar(item)).findFirst().orElse(null); } + private boolean simpleMatching(MinItemPrice minItemPrice, ItemStack item) { + boolean modelDataMatch = true; + + boolean typeMatch = minItemPrice.getItemStack().getType() == item.getType(); + + if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) + if (minItemPrice.getItemStack().getItemMeta() != null && minItemPrice.getItemStack().getItemMeta().hasCustomModelData() && item.getItemMeta() != null && item.getItemMeta().hasCustomModelData()) + modelDataMatch = minItemPrice.getItemStack().getItemMeta().getCustomModelData() == item.getItemMeta().getCustomModelData(); + + + return typeMatch && modelDataMatch; + } + public List getMinPrices() { return this.minPrices; } diff --git a/src/main/java/ca/tweetzy/auctionhouse/managers/SoundManager.java b/src/main/java/ca/tweetzy/auctionhouse/managers/SoundManager.java index 0dcb80d..ea0d136 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/managers/SoundManager.java +++ b/src/main/java/ca/tweetzy/auctionhouse/managers/SoundManager.java @@ -18,14 +18,10 @@ package ca.tweetzy.auctionhouse.managers; -import ca.tweetzy.auctionhouse.AuctionHouse; +import ca.tweetzy.auctionhouse.settings.Settings; import ca.tweetzy.flight.comp.enums.CompSound; -import org.bukkit.Bukkit; -import org.bukkit.Sound; import org.bukkit.entity.Player; -import java.util.Arrays; - /** * The current file has been created by Kiran Hart * Date Created: February 11 2021 @@ -46,16 +42,7 @@ public class SoundManager { private SoundManager() { } - public void playSound(Player player, String sound, float volume, float pitch) { - player.playSound(player.getLocation(), CompSound.matchCompSound(sound).get().parseSound(), volume, pitch); - } - - public void playSound(Player[] players, String sound, float volume, float pitch) { - final Sound xsound = CompSound.matchCompSound(sound).get().parseSound(); - Arrays.stream(players).forEach(p -> p.playSound(p.getLocation(), xsound, volume, pitch)); - } - - public void playSound(Player player, String sound, float volume, float pitch, int delay) { - Bukkit.getServer().getScheduler().runTaskLater(AuctionHouse.getInstance(), () -> playSound(player, sound, volume, pitch), delay); + public void playSound(Player player, String sound) { + player.playSound(player.getLocation(), CompSound.matchCompSound(sound).get().parseSound(), Float.parseFloat(Settings.SOUND_VOLUME.getString()), Float.parseFloat(Settings.SOUND_PITCH.getString())); } } diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java index 8bf2255..496ba1d 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java +++ b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java @@ -119,6 +119,8 @@ public class Settings { public static final ConfigSetting FORCE_AUCTION_USAGE = new ConfigSetting(config, "auction setting.force auction usage", false, "If enabled, all items sold on the auction house must be an auction (biddable) items"); public static final ConfigSetting ALLOW_INDIVIDUAL_ITEM_CLAIM = new ConfigSetting(config, "auction setting.allow individual item claim", true, "If enabled, you will be able to click individual items from the expiration menu to claim them back. Otherwise you will have to use the claim all button"); public static final ConfigSetting FORCE_CUSTOM_BID_AMOUNT = new ConfigSetting(config, "auction setting.force custom bid amount", false, "If enabled, the bid increment line on auction items will be hidden, bid increment values will be ignored, and when you go to bid on an item, it will ask you to enter a custom amount."); + public static final ConfigSetting SOUND_PITCH = new ConfigSetting(config, "auction setting.sound.pitch", 1.0, "The pitch value for sounds played by auction house"); + public static final ConfigSetting SOUND_VOLUME = new ConfigSetting(config, "auction setting.sound.volume", 1.0, "The volume value for sounds played by auction house"); public static final ConfigSetting BIDDING_TAKES_MONEY = new ConfigSetting(config, "auction setting.bidding takes money", false, "If enabled, players will be outright charged the current bid for the item", "If they are outbid or the item is cancelled, they will get their money back. Disables ability for owners to bid on their own items!"); public static final ConfigSetting LIST_ITEM_DELAY = new ConfigSetting(config, "auction setting.list item delay", -1, "If not set to -1 (disabled) how many seconds must a player wait to list another item after listing 1?"); @@ -184,6 +186,7 @@ public class Settings { public static final ConfigSetting ALLOW_ITEM_BUNDLES = new ConfigSetting(config, "auction setting.bundles.enabled", true, "If true, players can use -b in the sell command to bundle all similar items into a single item."); public static final ConfigSetting ITEM_BUNDLE_ITEM = new ConfigSetting(config, "auction setting.bundles.item", CompMaterial.GOLD_BLOCK.name()); + public static final ConfigSetting MIN_ITEM_PRICE_USES_SIMPE_COMPARE = new ConfigSetting(config, "auction setting.use simple compare for min item price", true, "If true, AH will just compare material and model data types"); public static final ConfigSetting ITEM_BUNDLE_NAME = new ConfigSetting(config, "auction setting.bundles.name", "%item_name% &7Bundle"); public static final ConfigSetting ITEM_BUNDLE_LORE = new ConfigSetting(config, "auction setting.bundles.lore", Arrays.asList( "&7This is a bundle item, it contains", @@ -889,7 +892,8 @@ public class Settings { /* =============================== * ITEM SELL PLACE ITEM GUI * ===============================*/ - public static final ConfigSetting GUI_SELL_PLACE_ITEM_TITLE = new ConfigSetting(config, "gui.sell place item.title", "&7Auction House - &ePlace Item(s)"); + public static final ConfigSetting GUI_SELL_PLACE_ITEM_TITLE = new ConfigSetting(config, "gui.sell place item.title", "&7Auction House - &ePlace Item"); + public static final ConfigSetting GUI_SELL_PLACE_ITEM_BUNDLE_TITLE = new ConfigSetting(config, "gui.sell place item.bundle title", "&7Auction House - &ePlace Item(s)"); public static final ConfigSetting GUI_SELL_PLACE_ITEM_BG_ITEM = new ConfigSetting(config, "gui.sell place item.bg item", CompMaterial.BLACK_STAINED_GLASS_PANE.name()); public static final ConfigSetting GUI_SELL_PLACE_ITEM_ITEMS_CONTINUE_ITEM = new ConfigSetting(config, "gui.sell place item.items.continue.item", CompMaterial.LIME_STAINED_GLASS_PANE.name());