add %remaining_total_hours% variable to auction stack listings

Took 12 minutes
This commit is contained in:
Kiran Hart 2023-02-22 16:58:49 -05:00
parent 5b875db8fc
commit acae464405
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
3 changed files with 11 additions and 3 deletions

View File

@ -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())));
}

View File

@ -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()) {

View File

@ -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;