smart calculations for min price

Took 6 minutes
This commit is contained in:
Kiran Hart 2022-04-15 12:52:25 -04:00
parent eb6fb3193c
commit 61d0bf67d6
2 changed files with 9 additions and 0 deletions

View File

@ -140,6 +140,7 @@ public final class CommandSell extends AbstractCommand {
Double bidIncrement = null;
boolean isBundle = false;
boolean isInfinite = false;
boolean isStackPrice = false;
for (int i = 0; i < args.length; i++) {
@ -155,6 +156,9 @@ public final class CommandSell extends AbstractCommand {
if (args[i].equalsIgnoreCase("-b") || args[i].equalsIgnoreCase("-bundle"))
isBundle = true;
if (args[i].equalsIgnoreCase("-s") || args[i].equalsIgnoreCase("-stack"))
isStackPrice = true;
if ((args[i].equalsIgnoreCase("-i") || args[i].equalsIgnoreCase("-infinite")) && (player.hasPermission("auctionhouse.admin") || player.isOp()))
isInfinite = true;
@ -250,6 +254,10 @@ public final class CommandSell extends AbstractCommand {
return ReturnType.SUCCESS;
}
if (Settings.SMART_MIN_BUY_PRICE.getBoolean() && itemToSell.getAmount() > 1) {
buyNowPrice = isStackPrice ? buyNowPrice : buyNowPrice * itemToSell.getAmount();
}
if (Settings.ASK_FOR_LISTING_CONFIRMATION.getBoolean()) {
AuctionHouse.getInstance().getGuiManager().showGUI(player, new GUIConfirmListing(
player,

View File

@ -113,6 +113,7 @@ public class Settings {
public static final ConfigSetting PER_WORLD_ITEMS = new ConfigSetting(config, "auction setting.per world items", false, "If true, items can only be seen in the world they were listed in, same goes for bidding/buying/collecting");
public static final ConfigSetting ALLOW_PLAYERS_TO_DEFINE_AUCTION_TIME = new ConfigSetting(config, "auction setting.allow players to set auction time", false, "If true players can use -t 1 day for example to set the listing time for their item");
public static final ConfigSetting MAX_CUSTOM_DEFINED_TIME = new ConfigSetting(config, "auction setting.max custom defined time", 604800, "What should the limit on custom defined listing times be in seconds?");
public static final ConfigSetting SMART_MIN_BUY_PRICE = new ConfigSetting(config, "auction setting.smart min and buy price", true, "Will calculate buy now/min prices on a per item basis. For example, if the user states $100 and the item is in a stack of", "32, the min / buy now price will be $3200. If they provide -s or -stack in the command", "this will be ignored and the entire stack will sell for $100");
public static final ConfigSetting USE_SEPARATE_FILTER_MENU = new ConfigSetting(config, "auction setting.use separate filter menu", false, "If true, rather than using a single filter item inside the auction menu", "it will open an entirely new menu to select the filter");
public static final ConfigSetting SELL_MENU_REQUIRES_USER_TO_HOLD_ITEM = new ConfigSetting(config, "auction setting.require user to hold item when using sell menu", false, "If enabled, when running just /ah sell, the user will need to hold the item in their hand, otherwise they just add it in the gui.");