From acae46440585d422068029fd49e27531e687d246 Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Wed, 22 Feb 2023 16:58:49 -0500 Subject: [PATCH] =?UTF-8?q?=E2=8C=9B=20add=20%remaining=5Ftotal=5Fhours%?= =?UTF-8?q?=20variable=20to=20auction=20stack=20listings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Took 12 minutes --- .../ca/tweetzy/auctionhouse/auction/AuctionedItem.java | 3 +++ .../ca/tweetzy/auctionhouse/commands/CommandSell.java | 10 ++++++++-- .../tweetzy/auctionhouse/helpers/AuctionCreator.java | 1 - 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionedItem.java b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionedItem.java index 7691a52..20320af 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionedItem.java +++ b/src/main/java/ca/tweetzy/auctionhouse/auction/AuctionedItem.java @@ -127,11 +127,13 @@ public class AuctionedItem { lore.addAll(TextUtils.formatText(Settings.AUCTION_STACK_DETAILS_INFINITE.getStringList())); } else { long[] times = AuctionAPI.getInstance().getRemainingTimeValues((this.expiresAt - System.currentTimeMillis()) / 1000); + lore.addAll(TextUtils.formatText(Settings.AUCTION_STACK_DETAILS_TIME_LEFT.getStringList().stream().map(s -> s .replace("%remaining_days%", String.valueOf(times[0])) .replace("%remaining_hours%", String.valueOf(times[1])) .replace("%remaining_minutes%", String.valueOf(times[2])) .replace("%remaining_seconds%", String.valueOf(times[3])) + .replace("%remaining_total_hours%", String.valueOf(((this.expiresAt - System.currentTimeMillis()) / 1000) / 3600)) ).collect(Collectors.toList()))); } @@ -177,6 +179,7 @@ public class AuctionedItem { .replace("%remaining_hours%", String.valueOf(times[1])) .replace("%remaining_minutes%", String.valueOf(times[2])) .replace("%remaining_seconds%", String.valueOf(times[3])) + .replace("%remaining_total_hours%", String.valueOf(((this.expiresAt - System.currentTimeMillis()) / 1000) / 3600)) ).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 4ced90a..504593d 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java +++ b/src/main/java/ca/tweetzy/auctionhouse/commands/CommandSell.java @@ -219,7 +219,7 @@ public final class CommandSell extends AbstractCommand { return ReturnType.FAILURE; } - boolean isBiddingItem = Settings.FORCE_AUCTION_USAGE.getBoolean() || buyNowPrice != null && startingBid != null && Settings.ALLOW_USAGE_OF_BID_SYSTEM.getBoolean(); + final boolean isBiddingItem = Settings.FORCE_AUCTION_USAGE.getBoolean() || buyNowPrice != null && startingBid != null && Settings.ALLOW_USAGE_OF_BID_SYSTEM.getBoolean(); // NOT USING THE BIDDING SYSTEM if (!isBiddingItem /* && buyNowPrice != null */) { @@ -299,7 +299,13 @@ public final class CommandSell extends AbstractCommand { } // update the listing time to the max allowed time if it wasn't set using the command flag - allowedTime = allowedTime != 0 ? allowedTime : auctionPlayer.getAllowedSellTime(isBiddingItem ? AuctionSaleType.USED_BIDDING_SYSTEM : AuctionSaleType.WITHOUT_BIDDING_SYSTEM); +// allowedTime = allowedTime != 0 ? allowedTime : auctionPlayer.getAllowedSellTime( +// buyNowPrice != null && startingBid != null ? +// /*isBiddingItem ?*/ AuctionSaleType.USED_BIDDING_SYSTEM : AuctionSaleType.WITHOUT_BIDDING_SYSTEM +// ); + + allowedTime = allowedTime != 0 ? allowedTime : auctionPlayer.getAllowedSellTime(AuctionSaleType.WITHOUT_BIDDING_SYSTEM); + Bukkit.broadcastMessage(""+allowedTime); // Check list delay if (!auctionPlayer.canListItem()) { diff --git a/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java b/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java index 8c4858d..ce7b94a 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java +++ b/src/main/java/ca/tweetzy/auctionhouse/helpers/AuctionCreator.java @@ -37,7 +37,6 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiConsumer;