diff --git a/pom.xml b/pom.xml
index 3f75bc5..bae8ea0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
ca.tweetzy
auctionhouse
- 2.8.0
+ 2.9.0
UTF-8
@@ -77,6 +77,8 @@
com.zaxxer:HikariCP
org.slf4j:slf4j-api
org.slf4j:slf4j-nop
+ co.aikar:taskchain-bukkit
+ co.aikar:taskchain-core
@@ -94,6 +96,10 @@
ca.tweetzy.core
${project.groupId}.auctionhouse.core
+
+ co.aikar.taskchain
+ ${project.groupId}.auctionhouse.taskchain
+
@@ -103,6 +109,10 @@
+
+ aikar
+ https://repo.aikar.co/content/groups/aikar/
+
nms-repo
https://repo.codemc.org/repository/nms/
@@ -141,14 +151,19 @@
provided
- org.apache.maven.plugins
- maven-deploy-plugin
- 2.8.2
+ co.aikar
+ taskchain-bukkit
+ 3.7.2
com.zaxxer
HikariCP
3.2.0
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 2.8.2
+
\ No newline at end of file
diff --git a/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java
index 384ae35..4a28cad 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/AuctionHouse.java
@@ -18,12 +18,14 @@ import ca.tweetzy.core.TweetyPlugin;
import ca.tweetzy.core.commands.CommandManager;
import ca.tweetzy.core.compatibility.ServerVersion;
import ca.tweetzy.core.configuration.Config;
-import ca.tweetzy.core.core.PluginID;
import ca.tweetzy.core.database.DataMigrationManager;
import ca.tweetzy.core.database.DatabaseConnector;
import ca.tweetzy.core.database.MySQLConnector;
import ca.tweetzy.core.gui.GuiManager;
import ca.tweetzy.core.utils.Metrics;
+import co.aikar.taskchain.BukkitTaskChainFactory;
+import co.aikar.taskchain.TaskChain;
+import co.aikar.taskchain.TaskChainFactory;
import lombok.Getter;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
@@ -41,6 +43,7 @@ import java.util.List;
@SuppressWarnings("unused")
public class AuctionHouse extends TweetyPlugin {
+ private static TaskChainFactory taskChainFactory;
private static AuctionHouse instance;
@Getter
@@ -82,7 +85,7 @@ public class AuctionHouse extends TweetyPlugin {
@Override
public void onPluginEnable() {
- TweetyCore.registerPlugin(this, (int) PluginID.AUCTION_HOUSE.getTweetzyID(), "CHEST");
+ TweetyCore.registerPlugin(this, 1, "CHEST");
// Check server version
if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_7)) {
@@ -96,6 +99,8 @@ public class AuctionHouse extends TweetyPlugin {
if (rsp != null) this.economy = rsp.getProvider();
}
+ taskChainFactory = BukkitTaskChainFactory.create(this);
+
// Settings
Settings.setup();
@@ -156,7 +161,7 @@ public class AuctionHouse extends TweetyPlugin {
getServer().getScheduler().runTaskLaterAsynchronously(this, () -> this.status = new UpdateChecker(this, 60325, getConsole()).check().getStatus(), 1L);
// metrics
- this.metrics = new Metrics(this, (int) PluginID.AUCTION_HOUSE.getbStatsID());
+ this.metrics = new Metrics(this, 6806);
}
@Override
@@ -181,6 +186,14 @@ public class AuctionHouse extends TweetyPlugin {
return instance;
}
+ public static TaskChain newChain() {
+ return taskChainFactory.newChain();
+ }
+
+ public static TaskChain newSharedChain(String name) {
+ return taskChainFactory.newSharedChain(name);
+ }
+
String IS_SONGODA_DOWNLOAD = "%%__SONGODA__%%";
String SONGODA_NODE = "%%__SONGODA_NODE__%%";
String TIMESTAMP = "%%__TIMESTAMP__%%";
diff --git a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItem.java b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItem.java
index e51b9ab..fadcbf0 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItem.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionItem.java
@@ -8,18 +8,15 @@ import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.core.utils.nms.NBTEditor;
import lombok.Getter;
import lombok.Setter;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
-import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
@@ -81,13 +78,15 @@ public class AuctionItem implements Serializable {
List lore = (meta.hasLore()) ? meta.getLore() : new ArrayList<>();
String theSeller = (this.owner == null) ? "&eSeller Name???" : Bukkit.getOfflinePlayer(this.owner).getName();
- String highestBidder = (this.bidStartPrice <= 0 || this.bidIncPrice <= 0) ? "" : (this.owner.equals(this.highestBidder)) ? Bukkit.getOfflinePlayer(this.owner).getName() : (Bukkit.getOfflinePlayer(this.highestBidder).isOnline()) ? Bukkit.getOfflinePlayer(this.highestBidder).getPlayer().getName() : "Offline";
- String basePrice = Settings.USE_SHORT_NUMBERS_ON_ITEMS.getBoolean() ? AuctionAPI.getInstance().getFriendlyNumber(this.basePrice) : AuctionAPI.getInstance().formatNumber(this.basePrice);// base
+ String highestBidder = (this.bidStartPrice <= 0 || this.bidIncPrice <= 0) ? "" : (this.owner.equals(this.highestBidder)) ? Bukkit.getOfflinePlayer(this.owner).getName() : Bukkit.getOfflinePlayer(this.highestBidder).getName();
+
+ String basePrice = this.basePrice == -1 ? Settings.AUCTION_PURCHASE_CONTROLS_BUY_NOW_OFF_FOR_BID.getString() : Settings.USE_SHORT_NUMBERS_ON_ITEMS.getBoolean() ? AuctionAPI.getInstance().getFriendlyNumber(this.basePrice) : AuctionAPI.getInstance().formatNumber(this.basePrice);// base
+
String bidIncPrice = (this.bidStartPrice <= 0 || this.bidIncPrice <= 0) ? "0" : Settings.USE_SHORT_NUMBERS_ON_ITEMS.getBoolean() ? AuctionAPI.getInstance().getFriendlyNumber(this.bidIncPrice) : AuctionAPI.getInstance().formatNumber(this.bidIncPrice);
String currentPrice = (this.bidStartPrice <= 0 || this.bidIncPrice <= 0) ? "0" : Settings.USE_SHORT_NUMBERS_ON_ITEMS.getBoolean() ? AuctionAPI.getInstance().getFriendlyNumber(this.currentPrice) : AuctionAPI.getInstance().formatNumber(this.currentPrice);
long[] times = AuctionAPI.getInstance().getRemainingTimeValues(this.remainingTime);
- List preLore = type == AuctionStackType.MAIN_AUCTION_HOUSE ? this.bidStartPrice <= 0 || this.bidIncPrice <= 0 ? Settings.AUCTION_ITEM_AUCTION_STACK.getStringList() : Settings.AUCTION_ITEM_AUCTION_STACK_WITH_BID.getStringList() : this.bidStartPrice <= 0 ? Settings.AUCTION_ITEM_LISTING_STACK.getStringList() : Settings.AUCTION_ITEM_LISTING_STACK_WITH_BID.getStringList();
+ List preLore = type == AuctionStackType.MAIN_AUCTION_HOUSE ? this.bidStartPrice <= 0 || this.bidIncPrice <= 0 ? Settings.AUCTION_ITEM_AUCTION_STACK.getStringList() : Settings.AUCTION_ITEM_AUCTION_STACK_WITH_BID.getStringList() : this.bidStartPrice <= 0 ? Settings.AUCTION_ITEM_LISTING_STACK.getStringList() : Settings.AUCTION_ITEM_LISTING_STACK_WITH_BID.getStringList();
lore.addAll(preLore.stream().map(line -> TextUtils.formatText(line
.replace("%seller%", theSeller != null ? theSeller : "&eUnknown Seller")
@@ -102,7 +101,7 @@ public class AuctionItem implements Serializable {
if (type == AuctionStackType.MAIN_AUCTION_HOUSE) {
lore.addAll(Settings.AUCTION_PURCHASE_CONTROL_HEADER.getStringList().stream().map(TextUtils::formatText).collect(Collectors.toList()));
- lore.addAll(this.bidStartPrice <= 0 || this.bidIncPrice <= 0 ? Settings.AUCTION_PURCHASE_CONTROLS_BID_OFF.getStringList().stream().map(TextUtils::formatText).collect(Collectors.toList()) : Settings.AUCTION_PURCHASE_CONTROLS_BID_ON.getStringList().stream().map(TextUtils::formatText).collect(Collectors.toList()));
+ lore.addAll(this.bidStartPrice <= 0 || this.bidIncPrice <= 0 ? Settings.AUCTION_PURCHASE_CONTROLS_BID_OFF.getStringList().stream().map(TextUtils::formatText).collect(Collectors.toList()) : Settings.AUCTION_PURCHASE_CONTROLS_BID_ON.getStringList().stream().map(TextUtils::formatText).collect(Collectors.toList()));
if ((ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11) && itemStack.getType() == XMaterial.SHULKER_BOX.parseMaterial()) || (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14) && itemStack.getType() == XMaterial.SHULKER_BOX.parseMaterial() || itemStack.getType() == XMaterial.BARREL.parseMaterial())) {
lore.addAll(Settings.AUCTION_PURCHASE_CONTROLS_INSPECTION.getStringList().stream().map(TextUtils::formatText).collect(Collectors.toList()));
diff --git a/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java b/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java
index 7f8efb8..e127d58 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java
@@ -14,7 +14,6 @@ import ca.tweetzy.core.compatibility.CompatibleHand;
import ca.tweetzy.core.compatibility.XMaterial;
import ca.tweetzy.core.utils.NumberUtils;
import ca.tweetzy.core.utils.PlayerUtils;
-import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@@ -142,7 +141,7 @@ public class CommandSell extends AbstractCommand {
AuctionHouse.getInstance().getLocale().getMessage("auction.listed.nobid")
.processPlaceholder("amount", itemToSell.getAmount())
- .processPlaceholder("item", WordUtils.capitalizeFully(itemToSell.getType().name().replace("_", " ")))
+ .processPlaceholder("item", AuctionAPI.getInstance().getItemName(itemToSell))
.processPlaceholder("base_price", AuctionAPI.getInstance().formatNumber(basePrice))
.sendPrefixedMessage(player);
@@ -150,7 +149,7 @@ public class CommandSell extends AbstractCommand {
Bukkit.getOnlinePlayers().forEach(AuctionHouse.getInstance().getLocale().getMessage("auction.broadcast.nobid")
.processPlaceholder("player", player.getName())
.processPlaceholder("amount", itemToSell.getAmount())
- .processPlaceholder("item", WordUtils.capitalizeFully(itemToSell.getType().name().replace("_", " ")))
+ .processPlaceholder("item", AuctionAPI.getInstance().getItemName(itemToSell))
.processPlaceholder("base_price", AuctionAPI.getInstance().formatNumber(basePrice))::sendPrefixedMessage);
}
@@ -183,7 +182,7 @@ public class CommandSell extends AbstractCommand {
double bidIncPrice = Double.parseDouble(args[2]);
// check min
- if (basePrice < Settings.MIN_AUCTION_PRICE.getDouble()) {
+ if (basePrice < Settings.MIN_AUCTION_PRICE.getDouble() && !(basePrice <= -1)) {
AuctionHouse.getInstance().getLocale().getMessage("pricing.minbaseprice").processPlaceholder("price", Settings.MIN_AUCTION_PRICE.getDouble()).sendPrefixedMessage(player);
return ReturnType.FAILURE;
}
@@ -214,7 +213,7 @@ public class CommandSell extends AbstractCommand {
return ReturnType.FAILURE;
}
- if (Settings.BASE_PRICE_MUST_BE_HIGHER_THAN_BID_START.getBoolean() && bidStartPrice > basePrice) {
+ if (Settings.BASE_PRICE_MUST_BE_HIGHER_THAN_BID_START.getBoolean() && bidStartPrice > basePrice && !(basePrice <= -1)) {
AuctionHouse.getInstance().getLocale().getMessage("pricing.basepricetoolow").sendPrefixedMessage(player);
return ReturnType.FAILURE;
}
@@ -225,7 +224,7 @@ public class CommandSell extends AbstractCommand {
itemToSell,
MaterialCategorizer.getMaterialCategory(itemToSell),
UUID.randomUUID(),
- basePrice,
+ basePrice <= -1 ? -1 : basePrice,
bidStartPrice,
bidIncPrice,
bidStartPrice,
@@ -241,8 +240,8 @@ public class CommandSell extends AbstractCommand {
AuctionHouse.getInstance().getLocale().getMessage("auction.listed.withbid")
.processPlaceholder("amount", itemToSell.getAmount())
- .processPlaceholder("item", WordUtils.capitalizeFully(itemToSell.getType().name().replace("_", " ")))
- .processPlaceholder("base_price", AuctionAPI.getInstance().formatNumber(basePrice))
+ .processPlaceholder("item", AuctionAPI.getInstance().getItemName(itemToSell))
+ .processPlaceholder("base_price", basePrice <= -1 ? AuctionHouse.getInstance().getLocale().getMessage("auction.biditemwithdisabledbuynow").getMessage() : AuctionAPI.getInstance().formatNumber(basePrice))
.processPlaceholder("start_price", AuctionAPI.getInstance().formatNumber(bidStartPrice))
.processPlaceholder("increment_price", AuctionAPI.getInstance().formatNumber(bidIncPrice))
.sendPrefixedMessage(player);
@@ -251,8 +250,8 @@ public class CommandSell extends AbstractCommand {
Bukkit.getOnlinePlayers().forEach(AuctionHouse.getInstance().getLocale().getMessage("auction.broadcast.withbid")
.processPlaceholder("player", player.getName())
.processPlaceholder("amount", itemToSell.getAmount())
- .processPlaceholder("item", WordUtils.capitalizeFully(itemToSell.getType().name().replace("_", " ")))
- .processPlaceholder("base_price", AuctionAPI.getInstance().formatNumber(basePrice))
+ .processPlaceholder("item", AuctionAPI.getInstance().getItemName(itemToSell))
+ .processPlaceholder("base_price", basePrice <= -1 ? AuctionHouse.getInstance().getLocale().getMessage("auction.biditemwithdisabledbuynow").getMessage() : AuctionAPI.getInstance().formatNumber(basePrice))
.processPlaceholder("start_price", AuctionAPI.getInstance().formatNumber(bidStartPrice))
.processPlaceholder("increment_price", AuctionAPI.getInstance().formatNumber(bidIncPrice))::sendPrefixedMessage);
}
diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java
index afad0d8..e71fe5e 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java
@@ -8,6 +8,7 @@ import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.managers.SoundManager;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.compatibility.ServerVersion;
+import ca.tweetzy.core.compatibility.XMaterial;
import ca.tweetzy.core.gui.Gui;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.core.utils.items.TItemBuilder;
@@ -41,10 +42,10 @@ public class GUIAuctionHouse extends Gui {
private BukkitTask task;
private AuctionItemCategory filterCategory = AuctionItemCategory.ALL;
private AuctionSaleType filterAuctionType = AuctionSaleType.BOTH;
+ private String searchPhrase = "";
public GUIAuctionHouse(AuctionPlayer auctionPlayer) {
this.auctionPlayer = auctionPlayer;
- this.items = AuctionHouse.getInstance().getAuctionItemManager().getAuctionItems().stream().filter(item -> !item.isExpired()).collect(Collectors.toList());
setTitle(TextUtils.formatText(Settings.GUI_AUCTION_HOUSE_TITLE.getString()));
setRows(6);
setAcceptsItems(false);
@@ -58,7 +59,7 @@ public class GUIAuctionHouse extends Gui {
public GUIAuctionHouse(AuctionPlayer auctionPlayer, String phrase) {
this(auctionPlayer);
- // re-fetch the auction items since we wanna filter out any items that match the phrase
+ this.searchPhrase = phrase;
this.items = this.items.stream().filter(auctionItem -> AuctionAPI.getInstance().match(phrase, ChatColor.stripColor(auctionItem.getItemName())) || AuctionAPI.getInstance().match(phrase, auctionItem.getCategory().getType()) || AuctionAPI.getInstance().match(phrase, auctionItem.getCategory().getTranslatedType()) || AuctionAPI.getInstance().match(phrase, Bukkit.getOfflinePlayer(auctionItem.getOwner()).getName())).collect(Collectors.toList());
}
@@ -66,97 +67,34 @@ public class GUIAuctionHouse extends Gui {
this(auctionPlayer);
this.filterCategory = filterCategory;
this.filterAuctionType = filterAuctionType;
-
- // Apply any filtering, there is probably a cleaner way of doing this, but I'm blanking
- if (this.filterCategory != AuctionItemCategory.ALL)
- items = items.stream().filter(item -> item.getCategory() == this.filterCategory).collect(Collectors.toList());
- if (this.filterAuctionType != AuctionSaleType.BOTH)
- items = items.stream().filter(item -> this.filterAuctionType == AuctionSaleType.USED_BIDDING_SYSTEM ? item.getBidStartPrice() >= Settings.MIN_AUCTION_START_PRICE.getDouble() : item.getBidStartPrice() <= 0).collect(Collectors.toList());
}
public void draw() {
reset();
+ drawFixedButtons();
+ drawItems();
+ }
- // Pagination
- 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());
- 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 -> {
- 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()) {
- return;
- }
- }
- AuctionHouse.getInstance().getAuctionPlayerManager().addCooldown(this.auctionPlayer.getPlayer().getUniqueId());
+
+ private void drawItems() {
+ AuctionHouse.newChain().asyncFirst(() -> {
+ this.items = AuctionHouse.getInstance().getAuctionItemManager().getAuctionItems().stream().filter(item -> !item.isExpired()).collect(Collectors.toList());
+
+ if (this.searchPhrase.length() != 0) {
+ this.items = this.items.stream().filter(auctionItem -> AuctionAPI.getInstance().match(this.searchPhrase, ChatColor.stripColor(auctionItem.getItemName())) || AuctionAPI.getInstance().match(this.searchPhrase, auctionItem.getCategory().getType()) || AuctionAPI.getInstance().match(this.searchPhrase, auctionItem.getCategory().getTranslatedType()) || AuctionAPI.getInstance().match(this.searchPhrase, Bukkit.getOfflinePlayer(auctionItem.getOwner()).getName())).collect(Collectors.toList());
}
- cleanup();
- e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
- });
- 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();
- SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString(), 1.0F, 1.0F);
- });
- // Other Buttons
- setButton(5, 0, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_YOUR_AUCTIONS_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_YOUR_AUCTIONS_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_YOUR_AUCTIONS_LORE.getStringList(), new HashMap() {{
- put("%active_player_auctions%", auctionPlayer.getItems(false).size());
- put("%player_balance%", AuctionAPI.getInstance().formatNumber(AuctionHouse.getInstance().getEconomy().getBalance(auctionPlayer.getPlayer())));
- }}), e -> {
- cleanup();
- e.manager.showGUI(e.player, new GUIActiveAuctions(this.auctionPlayer));
- });
+ if (this.filterCategory != AuctionItemCategory.ALL)
+ this.items = items.stream().filter(item -> item.getCategory() == this.filterCategory).collect(Collectors.toList());
+ if (this.filterAuctionType != AuctionSaleType.BOTH)
+ this.items = this.items.stream().filter(item -> this.filterAuctionType == AuctionSaleType.USED_BIDDING_SYSTEM ? item.getBidStartPrice() >= Settings.MIN_AUCTION_START_PRICE.getDouble() : item.getBidStartPrice() <= 0).collect(Collectors.toList());
- setButton(5, 1, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_COLLECTION_BIN_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_COLLECTION_BIN_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_COLLECTION_BIN_LORE.getStringList(), new HashMap() {{
- put("%expired_player_auctions%", auctionPlayer.getItems(true).size());
- }}), e -> {
- cleanup();
- e.manager.showGUI(e.player, new GUIExpiredItems(this.auctionPlayer));
- });
-
- setButton(5, 2, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_LORE.getStringList(), new HashMap() {{
- put("%filter_category%", filterCategory.getTranslatedType());
- put("%filter_auction_type%", filterAuctionType.getTranslatedType());
- }}), e -> {
- switch (e.clickType) {
- case LEFT:
- this.filterCategory = this.filterCategory.next();
- if (Settings.REFRESH_GUI_ON_FILTER_CHANGE.getBoolean()) {
- cleanup();
- e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer, this.filterCategory, this.filterAuctionType));
- } else {
- draw();
- }
- break;
- case RIGHT:
- this.filterAuctionType = this.filterAuctionType.next();
- if (Settings.REFRESH_GUI_ON_FILTER_CHANGE.getBoolean()) {
- cleanup();
- e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer, this.filterCategory, this.filterAuctionType));
- } else {
- draw();
- }
- break;
- }
- });
-
- // this could be done better tbh
- setButton(5, 6, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_TRANSACTIONS_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_TRANSACTIONS_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_TRANSACTIONS_LORE.getStringList(), new HashMap(){{
- put("%total_items_bought%", AuctionHouse.getInstance().getTransactionManager().getTransactions().stream().filter(transaction -> transaction.getBuyer().equals(auctionPlayer.getPlayer().getUniqueId())).count());
- put("%total_items_sold%", AuctionHouse.getInstance().getTransactionManager().getTransactions().stream().filter(transaction -> transaction.getSeller().equals(auctionPlayer.getPlayer().getUniqueId())).count());
- }}), e -> e.manager.showGUI(e.player, new GUITransactionList(this.auctionPlayer)));
-
- setButton(5, 7, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_HOW_TO_SELL_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_HOW_TO_SELL_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_HOW_TO_SELL_LORE.getStringList(), null), null);
- setButton(5, 8, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_LORE.getStringList(), null), null);
-
- // Items
- List data = this.items.stream().sorted(Comparator.comparingInt(AuctionItem::getRemainingTime).reversed()).skip((page - 1) * 45L).limit(45).collect(Collectors.toList());
- if (Settings.FILL_ITEMS_USING_ASYNC.getBoolean()) {
- Bukkit.getServer().getScheduler().runTaskAsynchronously(AuctionHouse.getInstance(), () -> placeItems(data));
- return;
- }
-
- placeItems(data);
+ return this.items.stream().sorted(Comparator.comparingInt(AuctionItem::getRemainingTime).reversed()).skip((page - 1) * 45L).limit(45).collect(Collectors.toList());
+ }).asyncLast((data) -> {
+ pages = (int) Math.max(1, Math.ceil(this.items.size() / (double) 45L));
+ drawPaginationButtons();
+ placeItems(data);
+ }).execute();
}
private void placeItems(List data) {
@@ -250,6 +188,10 @@ public class GUIAuctionHouse extends Gui {
if (auctionItem.getBidStartPrice() >= Settings.MIN_AUCTION_START_PRICE.getDouble()) {
if (!Settings.ALLOW_USAGE_OF_BUY_NOW_SYSTEM.getBoolean()) return;
+ if (auctionItem.getBasePrice() <= -1) {
+ AuctionHouse.getInstance().getLocale().getMessage("general.buynowdisabledonitem").sendPrefixedMessage(e.player);
+ return;
+ }
cleanup();
e.manager.showGUI(e.player, new GUIConfirmPurchase(this.auctionPlayer, auctionItem, false));
}
@@ -259,35 +201,96 @@ public class GUIAuctionHouse extends Gui {
}
}
- private void startTask() {
- taskId = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AuctionHouse.getInstance(), this::draw, 0L, (long) 20 * Settings.TICK_UPDATE_GUI_TIME.getInt());
+ 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());
+ setOnPage(e -> {
+ draw();
+ SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString(), 1.0F, 1.0F);
+ });
}
- private void startTaskAsync() {
- task = Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(AuctionHouse.getInstance(), this::draw, 0L, (long) 20 * Settings.TICK_UPDATE_GUI_TIME.getInt());
+ private void drawFixedButtons() {
+ setButton(5, 0, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_YOUR_AUCTIONS_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_YOUR_AUCTIONS_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_YOUR_AUCTIONS_LORE.getStringList(), new HashMap() {{
+ put("%active_player_auctions%", auctionPlayer.getItems(false).size());
+ put("%player_balance%", AuctionAPI.getInstance().formatNumber(AuctionHouse.getInstance().getEconomy().getBalance(auctionPlayer.getPlayer())));
+ }}), e -> {
+ cleanup();
+ e.manager.showGUI(e.player, new GUIActiveAuctions(this.auctionPlayer));
+ });
+
+ setButton(5, 1, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_COLLECTION_BIN_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_COLLECTION_BIN_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_COLLECTION_BIN_LORE.getStringList(), new HashMap() {{
+ put("%expired_player_auctions%", auctionPlayer.getItems(true).size());
+ }}), e -> {
+ cleanup();
+ e.manager.showGUI(e.player, new GUIExpiredItems(this.auctionPlayer));
+ });
+
+ drawFilterButton();
+
+ setButton(5, 6, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_TRANSACTIONS_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_TRANSACTIONS_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_TRANSACTIONS_LORE.getStringList(), new HashMap() {{
+ put("%total_items_bought%", AuctionHouse.getInstance().getTransactionManager().getTransactions().stream().filter(transaction -> transaction.getBuyer().equals(auctionPlayer.getPlayer().getUniqueId())).count());
+ put("%total_items_sold%", AuctionHouse.getInstance().getTransactionManager().getTransactions().stream().filter(transaction -> transaction.getSeller().equals(auctionPlayer.getPlayer().getUniqueId())).count());
+ }}), e -> e.manager.showGUI(e.player, new GUITransactionList(this.auctionPlayer)));
+
+ setButton(5, 7, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_HOW_TO_SELL_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_HOW_TO_SELL_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_HOW_TO_SELL_LORE.getStringList(), null), null);
+ setButton(5, 8, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_GUIDE_LORE.getStringList(), null), null);
+
+ 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 -> {
+ 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()) {
+ return;
+ }
+ }
+ AuctionHouse.getInstance().getAuctionPlayerManager().addCooldown(this.auctionPlayer.getPlayer().getUniqueId());
+ }
+ cleanup();
+ e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer, this.filterCategory, this.filterAuctionType));
+ });
}
- private void killTask() {
- Bukkit.getServer().getScheduler().cancelTask(taskId);
+ private void drawFilterButton() {
+ setButton(5, 2, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_ITEM.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_NAME.getString(), Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_LORE.getStringList(), new HashMap() {{
+ put("%filter_category%", filterCategory.getTranslatedType());
+ put("%filter_auction_type%", filterAuctionType.getTranslatedType());
+ }}), e -> {
+ switch (e.clickType) {
+ case LEFT:
+ this.filterCategory = this.filterCategory.next();
+ updateFilter();
+ break;
+ case RIGHT:
+ this.filterAuctionType = this.filterAuctionType.next();
+ updateFilter();
+ break;
+ }
+ });
}
- private void killAsyncTask() {
- task.cancel();
+ private void updateFilter() {
+ setItems(0, 44, XMaterial.AIR.parseItem());
+ drawItems();
+ drawFilterButton();
}
+ /*
+ ====================== AUTO REFRESH ======================
+ */
private void makeMess() {
if (Settings.USE_ASYNC_GUI_REFRESH.getBoolean()) {
- startTaskAsync();
+ task = Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(AuctionHouse.getInstance(), this::drawItems, 0L, (long) 20 * Settings.TICK_UPDATE_GUI_TIME.getInt());
} else {
- startTask();
+ taskId = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AuctionHouse.getInstance(), this::drawItems, 0L, (long) 20 * Settings.TICK_UPDATE_GUI_TIME.getInt());
}
}
private void cleanup() {
if (Settings.USE_ASYNC_GUI_REFRESH.getBoolean()) {
- killAsyncTask();
+ task.cancel();
} else {
- killTask();
+ Bukkit.getServer().getScheduler().cancelTask(taskId);
}
}
+
}
diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/transaction/GUITransactionList.java b/src/main/java/ca/tweetzy/auctionhouse/guis/transaction/GUITransactionList.java
index d322a06..069b1dc 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/guis/transaction/GUITransactionList.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/guis/transaction/GUITransactionList.java
@@ -35,7 +35,7 @@ public class GUITransactionList extends Gui {
public GUITransactionList(AuctionPlayer auctionPlayer) {
this.auctionPlayer = auctionPlayer;
this.transactions = AuctionHouse.getInstance().getTransactionManager().getTransactions();
- this.showOwnOnly = false;
+ this.showOwnOnly = true;
setTitle(TextUtils.formatText(Settings.GUI_TRANSACTIONS_TITLE.getString()));
setRows(6);
setAcceptsItems(false);
@@ -44,42 +44,43 @@ public class GUITransactionList extends Gui {
private void draw() {
reset();
+ AuctionHouse.newChain().async(() -> {
+ 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.auctionPlayer)));
+ 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();
+ SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString(), 1.0F, 1.0F);
+ });
- // Pagination
- 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.auctionPlayer)));
- 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();
- SoundManager.getInstance().playSound(this.auctionPlayer.getPlayer(), Settings.SOUNDS_NAVIGATE_GUI_PAGES.getString(), 1.0F, 1.0F);
- });
+ // Other Buttons
+ 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, 1, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_TRANSACTIONS_ITEM_TOGGLE_OWN_ITEM.getString(), Settings.GUI_TRANSACTIONS_ITEM_TOGGLE_OWN_NAME.getString(), Settings.GUI_TRANSACTIONS_ITEM_TOGGLE_OWN_LORE.getStringList(), null), e -> {
+ this.showOwnOnly = !this.showOwnOnly;
+ draw();
+ });
- // Other Buttons
- 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, 1, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_TRANSACTIONS_ITEM_TOGGLE_OWN_ITEM.getString(), Settings.GUI_TRANSACTIONS_ITEM_TOGGLE_OWN_NAME.getString(), Settings.GUI_TRANSACTIONS_ITEM_TOGGLE_OWN_LORE.getStringList(), null), e -> {
- this.showOwnOnly = !this.showOwnOnly;
- draw();
- });
+ if (this.showOwnOnly) {
+ highlightItem(5, 1);
+ } else {
+ removeHighlight(5, 1);
+ }
- if (this.showOwnOnly) {
- highlightItem(5, 1);
- } else {
- removeHighlight(5, 1);
- }
+ int slot = 0;
+ List data = this.transactions.stream().sorted(Comparator.comparingLong(Transaction::getTransactionTime).reversed()).skip((page - 1) * 45L).limit(45).collect(Collectors.toList());
+ if (this.showOwnOnly)
+ data = data.stream().filter(transaction -> transaction.getSeller().equals(this.auctionPlayer.getPlayer().getUniqueId()) || transaction.getBuyer().equals(this.auctionPlayer.getPlayer().getUniqueId())).collect(Collectors.toList());
- int slot = 0;
- List data = this.transactions.stream().sorted(Comparator.comparingLong(Transaction::getTransactionTime).reversed()).skip((page - 1) * 45L).limit(45).collect(Collectors.toList());
- if (this.showOwnOnly)
- data = data.stream().filter(transaction -> transaction.getSeller().equals(this.auctionPlayer.getPlayer().getUniqueId())).collect(Collectors.toList());
-
- for (Transaction transaction : data) {
- setButton(slot++, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_TRANSACTIONS_ITEM_TRANSACTION_ITEM.getString(), Settings.GUI_TRANSACTIONS_ITEM_TRANSACTION_NAME.getString(), Settings.GUI_TRANSACTIONS_ITEM_TRANSACTION_LORE.getStringList(), new HashMap() {{
- put("%transaction_id%", transaction.getId().toString());
- put("%seller%", Bukkit.getOfflinePlayer(transaction.getSeller()).getName());
- put("%buyer%", Bukkit.getOfflinePlayer(transaction.getBuyer()).getName());
- put("%date%", AuctionAPI.getInstance().convertMillisToDate(transaction.getTransactionTime()));
- }}), e -> e.manager.showGUI(e.player, new GUITransactionView(this.auctionPlayer, transaction)));
- }
+ for (Transaction transaction : data) {
+ setButton(slot++, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_TRANSACTIONS_ITEM_TRANSACTION_ITEM.getString(), Settings.GUI_TRANSACTIONS_ITEM_TRANSACTION_NAME.getString(), Settings.GUI_TRANSACTIONS_ITEM_TRANSACTION_LORE.getStringList(), new HashMap() {{
+ put("%transaction_id%", transaction.getId().toString());
+ put("%seller%", Bukkit.getOfflinePlayer(transaction.getSeller()).getName());
+ put("%buyer%", Bukkit.getOfflinePlayer(transaction.getBuyer()).getName());
+ put("%date%", AuctionAPI.getInstance().convertMillisToDate(transaction.getTransactionTime()));
+ put("%item_name%", AuctionAPI.getInstance().getItemName(AuctionAPI.getInstance().deserializeItem(transaction.getAuctionItem().getRawItem())));
+ }}), e -> e.manager.showGUI(e.player, new GUITransactionView(this.auctionPlayer, transaction)));
+ }
+ }).execute();
}
}
diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/transaction/GUITransactionView.java b/src/main/java/ca/tweetzy/auctionhouse/guis/transaction/GUITransactionView.java
index da6c20e..173ac49 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/guis/transaction/GUITransactionView.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/guis/transaction/GUITransactionView.java
@@ -1,5 +1,6 @@
package ca.tweetzy.auctionhouse.guis.transaction;
+import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.auction.AuctionItem;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
@@ -41,7 +42,7 @@ public class GUITransactionView extends Gui {
setItem(3, 4, ConfigurationItemHelper.createConfigurationItem(Settings.GUI_TRANSACTION_VIEW_ITEM_INFO_ITEM.getString(), Settings.GUI_TRANSACTION_VIEW_ITEM_INFO_NAME.getString(), Settings.GUI_TRANSACTION_VIEW_ITEM_INFO_LORE.getStringList(), new HashMap() {{
put("%transaction_id%", transaction.getId().toString());
- put("%sale_type%", transaction.getAuctionSaleType() == AuctionSaleType.USED_BIDDING_SYSTEM ? "Won Auction" : "Bought Immediately");
+ put("%sale_type%", transaction.getAuctionSaleType() == AuctionSaleType.USED_BIDDING_SYSTEM ? AuctionHouse.getInstance().getLocale().getMessage("transaction.sale_type.bid_won").getMessage() : AuctionHouse.getInstance().getLocale().getMessage("transaction.sale_type.immediate_buy").getMessage());
put("%transaction_date%", AuctionAPI.getInstance().convertMillisToDate(transaction.getTransactionTime()));
put("%final_price%", AuctionAPI.getInstance().formatNumber(transaction.getFinalPrice()));
}}));
diff --git a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java
index 5d083de..e98ae4e 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/settings/Settings.java
@@ -39,17 +39,15 @@ public class Settings {
public static final ConfigSetting TICK_UPDATE_TIME = new ConfigSetting(config, "auction setting.tick auctions every", 1, "How many seconds should pass before the plugin updates all the times on items?");
public static final ConfigSetting TICK_UPDATE_GUI_TIME = new ConfigSetting(config, "auction setting.refresh gui every", 10, "How many seconds should pass before the auction gui auto refreshes?");
public static final ConfigSetting REFRESH_GUI_WHEN_BID = new ConfigSetting(config, "auction setting.refresh gui when bid", true, "Should the auction gui be re-opened (not redrawn) when a user places a bid, so they get the latest items?");
- public static final ConfigSetting REFRESH_GUI_ON_FILTER_CHANGE = new ConfigSetting(config, "auction setting.refresh gui when filter changed", false, "Should the gui refresh when the player changes the filter mode?");
public static final ConfigSetting RECORD_TRANSACTIONS = new ConfigSetting(config, "auction setting.record transactions", true, "Should every transaction be recorded (everything an auction is won or an item is bought)");
public static final ConfigSetting BROADCAST_AUCTION_LIST = new ConfigSetting(config, "auction setting.broadcast auction list", false, "Should the entire server be alerted when a player lists an item?");
public static final ConfigSetting PLAYER_NEEDS_TOTAL_PRICE_TO_BID = new ConfigSetting(config, "auction setting.bidder must have funds in account", false, "Should the player who is placing a bid on an item have the money in their account to cover the cost?");
- public static final ConfigSetting USE_ASYNC_GUI_REFRESH = new ConfigSetting(config, "auction setting.use async gui refresh", false, "Should the gui refresh be done using asynchronous tasks?", "This may reduce lag that can be caused, but", "items may have a flickering effect inside the gui.");
+ public static final ConfigSetting USE_ASYNC_GUI_REFRESH = new ConfigSetting(config, "auction setting.use async gui refresh", true, "Should the gui refresh be done using asynchronous tasks?", "This may reduce lag that can be caused, but", "items may have a flickering effect inside the gui.");
public static final ConfigSetting SEND_REMOVED_ITEM_BACK_TO_PLAYER = new ConfigSetting(config, "auction setting.send removed item back to player", true, "Should items removed by staff from the auction house be sent back to the player?");
public static final ConfigSetting ALLOW_USAGE_OF_BID_SYSTEM = new ConfigSetting(config, "auction setting.allow bid system usage", true, "Should players be allowed to use the bid option cmd params?");
public static final ConfigSetting ALLOW_USAGE_OF_BUY_NOW_SYSTEM = new ConfigSetting(config, "auction setting.allow buy now system usage", true, "Should players be allowed to use the right-click buy now feature on biddable items?");
public static final ConfigSetting AUTO_SAVE_ENABLED = new ConfigSetting(config, "auction setting.auto save.enabled", true, "Should the auto save task be enabled?");
public static final ConfigSetting AUTO_SAVE_EVERY = new ConfigSetting(config, "auction setting.auto save.time", 900, "How often should the auto save active? (in seconds. Ex. 900 = 15min)");
- public static final ConfigSetting FILL_ITEMS_USING_ASYNC = new ConfigSetting(config, "auction setting.fill auction items using async", true, "Should auction items be loaded into the gui asynchronously");
public static final ConfigSetting ALLOW_PURCHASE_OF_SPECIFIC_QUANTITIES = new ConfigSetting(config, "auction setting.allow purchase of specific quantities", false, "When a buy now item is right-clicked should it open a", "special gui to specify the quantity of items to buy from the stack?");
public static final ConfigSetting USE_REFRESH_COOL_DOWN = new ConfigSetting(config, "auction setting.use refresh cool down", true, "Should the refresh cooldown be enabled?");
public static final ConfigSetting REFRESH_COOL_DOWN = new ConfigSetting(config, "auction setting.refresh cool down", 2, "How many seconds should pass before the player can refresh the auction house again?");
@@ -326,6 +324,7 @@ public class Settings {
public static final ConfigSetting GUI_TRANSACTIONS_ITEM_TRANSACTION_LORE = new ConfigSetting(config, "gui.transactions.items.transaction.lore", Arrays.asList(
"&7Seller&F: &e%seller%",
"&7Buyer&F: &e%buyer%",
+ "&7Item name&F: %item_name%",
"&7Date&F: &e%date%",
"",
"&7Click to view more details"
@@ -418,6 +417,7 @@ public class Settings {
), "This will be appended at the end of the lore", "If the auction item is not using a bid, this will show");
public static final ConfigSetting AUCTION_PURCHASE_CONTROLS_INSPECTION = new ConfigSetting(config, "auction items.controls.inspection", Collections.singletonList("&eShift Right-Click to inspect"), "This will only be added to the control lore if the item can be inspected (skulker box)");
+ public static final ConfigSetting AUCTION_PURCHASE_CONTROLS_BUY_NOW_OFF_FOR_BID = new ConfigSetting(config, "auction items.controls.buy now is off for bid", "&cN/A", "If they player sets the buy now price to -1 on a bid item, it will mean make the item", "a bid item, but users will not be able to use the buy now option on the item.");
/* ===============================
* AUCTION STACKS
diff --git a/src/main/resources/en_US.lang b/src/main/resources/en_US.lang
index 72e8e77..11675b1 100644
--- a/src/main/resources/en_US.lang
+++ b/src/main/resources/en_US.lang
@@ -12,6 +12,7 @@ general:
blocked: "&cSorry, you are not allowed to sell &e%item%"
sellinglimit: "&cYou cannot sell more items, please remove/sell current active items"
noroom: "&cPlease clear room in your inventory to purchase that item."
+ buynowdisabledonitem: "&cBuy now is disabled on this item."
pricing:
minbaseprice: "&cThe minimum base price must be &a$%price%"
@@ -24,6 +25,11 @@ pricing:
moneyremove: "&c&l- $%price%"
moneyadd: "&a&l+ $%price%"
+transaction:
+ sale_type:
+ bid_won: "Won Auction"
+ immediate_buy: "Bought Immediately"
+
discord:
player_lost: "Player Lost o.O"
no_buyer: "No Buyer"
@@ -57,6 +63,7 @@ auction:
bidwon: "&eYou won the bid for&fx%amount% &6%item% &efor &a%price%"
itemsold: "&eYou sold &6%item% &eto &6%buyer_name% &efor &a%price%"
itemnotavailable: "&cThat item is no longer available :("
+ biditemwithdisabledbuynow: "&cN/A"
commands:
syntax: