#21 add option to use %remaining_days/hours/minutes/seconds% within clock (listing time) lore in sell menus

This commit is contained in:
Kiran Hart 2022-11-25 13:44:19 -05:00
parent a63067ce85
commit 6748cf3090
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
4 changed files with 25 additions and 2 deletions

View File

@ -77,10 +77,19 @@ public final class GUISellAuction extends AbstractPlaceholderGui {
reset();
if (Settings.ALLOW_PLAYERS_TO_DEFINE_AUCTION_TIME.getBoolean()) {
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()))
.name(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_NAME.getString())
.lore(Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_LORE.getStringList()).make(), click -> {
.lore(Replacer.replaceVariables(
Settings.GUI_SELL_AUCTION_ITEM_ITEMS_TIME_LORE.getStringList(),
"remaining_days", times[0],
"remaining_hours", times[1],
"remaining_minutes", times[2],
"remaining_seconds", times[3]
)).make(), click -> {
click.gui.exit();
new TitleInput(click.player, AuctionHouse.getInstance().getLocale().getMessage("titles.listing time.title").getMessage(), AuctionHouse.getInstance().getLocale().getMessage("titles.listing time.subtitle").getMessage()) {

View File

@ -73,10 +73,19 @@ public final class GUISellBin extends AbstractPlaceholderGui {
reset();
if (Settings.ALLOW_PLAYERS_TO_DEFINE_AUCTION_TIME.getBoolean()) {
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()))
.name(Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_NAME.getString())
.lore(Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_LORE.getStringList()).make(), click -> {
.lore(Replacer.replaceVariables(
Settings.GUI_SELL_BIN_ITEM_ITEMS_TIME_LORE.getStringList(),
"remaining_days", times[0],
"remaining_hours", times[1],
"remaining_minutes", times[2],
"remaining_seconds", times[3]
)).make(), click -> {
click.gui.exit();
new TitleInput(click.player, AuctionHouse.getInstance().getLocale().getMessage("titles.listing time.title").getMessage(), AuctionHouse.getInstance().getLocale().getMessage("titles.listing time.subtitle").getMessage()) {

View File

@ -80,6 +80,7 @@ public abstract class Input implements Listener, Runnable {
)
public void onChat(AsyncPlayerChatEvent e) {
if (e.getPlayer().equals(this.player)) {
this.onInput(e.getMessage());
e.setCancelled(true);
}

View File

@ -930,6 +930,8 @@ public class Settings {
public static final ConfigSetting GUI_SELL_BIN_ITEM_ITEMS_TIME_ITEM = new ConfigSetting(config, "gui.sell bin item.items.time.item", XMaterial.CLOCK.name());
public static final ConfigSetting GUI_SELL_BIN_ITEM_ITEMS_TIME_NAME = new ConfigSetting(config, "gui.sell bin item.items.time.name", "&e&lListing Time");
public static final ConfigSetting GUI_SELL_BIN_ITEM_ITEMS_TIME_LORE = new ConfigSetting(config, "gui.sell bin item.items.time.lore", Arrays.asList(
"",
"&eCurrent Time: &b%remaining_days%&fd &b%remaining_hours%&fh &b%remaining_minutes%&fm &b%remaining_seconds%&Fs",
"",
"&7Click to edit the listing time"
));
@ -972,6 +974,8 @@ public class Settings {
public static final ConfigSetting GUI_SELL_AUCTION_ITEM_ITEMS_TIME_ITEM = new ConfigSetting(config, "gui.sell auction item.items.time.item", XMaterial.CLOCK.name());
public static final ConfigSetting GUI_SELL_AUCTION_ITEM_ITEMS_TIME_NAME = new ConfigSetting(config, "gui.sell auction item.items.time.name", "&e&lListing Time");
public static final ConfigSetting GUI_SELL_AUCTION_ITEM_ITEMS_TIME_LORE = new ConfigSetting(config, "gui.sell auction item.items.time.lore", Arrays.asList(
"",
"&eCurrent Time: &b%remaining_days%&fd &b%remaining_hours%&fh &b%remaining_minutes%&fm &b%remaining_seconds%&Fs",
"",
"&7Click to edit the listing time"
));