This commit is contained in:
Kiran Hart 2021-08-22 01:10:01 -04:00
parent bc65b90625
commit 9f8e3abad2
5 changed files with 26 additions and 0 deletions

View File

@ -1,7 +1,9 @@
package ca.tweetzy.auctionhouse.auction;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.utils.TimeUtils;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.entity.Player;
@ -26,12 +28,29 @@ public class AuctionPlayer {
private AuctionSortType auctionSortType;
private String currentSearchPhrase;
private boolean showListingInfo = true;
private long lastListedItem = -1;
public AuctionPlayer(Player player) {
this.player = player;
resetFilter();
}
public boolean canListItem() {
if (Settings.LIST_ITEM_DELAY.getInt() == -1) {
return true;
}
if (this.lastListedItem == -1 || System.currentTimeMillis() >= this.lastListedItem) {
this.lastListedItem = System.currentTimeMillis() + 1000L * Settings.LIST_ITEM_DELAY.getInt();
return true;
}
AuctionHouse.getInstance().getLocale().getMessage("general.wait_to_list").processPlaceholder("time", (this.lastListedItem - System.currentTimeMillis()) / 1000).sendPrefixedMessage(this.player);
return false;
}
public List<AuctionedItem> getItems(boolean getExpired) {
List<AuctionedItem> items = new ArrayList<>();

View File

@ -54,6 +54,10 @@ public class CommandSell extends AbstractCommand {
return ReturnType.FAILURE;
}
if (!auctionPlayer.canListItem()) {
return ReturnType.FAILURE;
}
// open the sell menu if its 0;
if (args.length == 0) {
if (!Settings.ALLOW_USAGE_OF_SELL_GUI.getBoolean()) {

View File

@ -3,6 +3,7 @@ package ca.tweetzy.auctionhouse.managers;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.settings.Settings;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap;

View File

@ -44,6 +44,7 @@ public class LocaleSettings {
languageNodes.put("general.toggled listing.on", "&aYou turned on listing messages");
languageNodes.put("general.toggled listing.off", "&cYou turned off listing messages");
languageNodes.put("general.bought_item", "&aYou bought &fx%amount% %item%&a for &a$%price%");
languageNodes.put("general.wait_to_list", "&cPlease wait &4%time%&cs before listing another item");
languageNodes.put("pricing.minbaseprice", "&cThe minimum base price must be &a$%price%");

View File

@ -69,6 +69,7 @@ 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 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?");
public static final ConfigSetting ASK_FOR_CANCEL_CONFIRM_ON_BID_ITEMS = new ConfigSetting(config, "auction setting.ask for cancel confirm on bid items", true, "Should Auction House ask the user if they want to cancel the item?");
public static final ConfigSetting ASK_FOR_CANCEL_CONFIRM_ON_NON_BID_ITEMS = new ConfigSetting(config, "auction setting.ask for cancel confirm on non bid items", false, "Should Auction House ask the user if they want to cancel the item?");