mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-01-07 12:47:36 +01:00
🪲 Fixed bid increment logic to make more sense when using realistic bidding mode. Closes #52
Took 15 minutes
This commit is contained in:
parent
348fa536d9
commit
96a6a5a8d2
@ -68,6 +68,5 @@ public final class AuctionBid implements Bid {
|
||||
|
||||
@Override
|
||||
public void store(Consumer<Bid> storedItem) {
|
||||
// TODO implement auction bid store
|
||||
}
|
||||
}
|
||||
|
@ -205,8 +205,7 @@ public final class CommandSell extends AbstractCommand {
|
||||
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 */) {
|
||||
// min item price todo fix it broke
|
||||
if (!isBiddingItem) {
|
||||
if (!AuctionAPI.getInstance().meetsMinItemPrice(isBundle, isBiddingItem, originalItem, buyNowPrice, isBiddingItem ? startingBid : 0)) {
|
||||
instance.getLocale().getMessage("pricing.minitemprice").processPlaceholder("price", AuctionAPI.getInstance().formatNumber(instance.getMinItemPriceManager().getMinPrice(originalItem).getPrice())).sendPrefixedMessage(player);
|
||||
return ReturnType.FAILURE;
|
||||
@ -216,8 +215,7 @@ public final class CommandSell extends AbstractCommand {
|
||||
if (!checkBasePrice(player, buyNowPrice, false)) return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (isBiddingItem && /* buyNowPrice != null && */ startingBid != null) {
|
||||
// min item price todo fix it broke
|
||||
if (isBiddingItem && startingBid != null) {
|
||||
if (!AuctionAPI.getInstance().meetsMinItemPrice(isBundle, isBiddingItem, originalItem, buyNowPrice, isBiddingItem ? startingBid : 0)) {
|
||||
instance.getLocale().getMessage("pricing.minitemprice").processPlaceholder("price", AuctionAPI.getInstance().formatNumber(instance.getMinItemPriceManager().getMinPrice(originalItem).getPrice())).sendPrefixedMessage(player);
|
||||
return ReturnType.FAILURE;
|
||||
|
@ -73,7 +73,10 @@ public class GUIBid extends AbstractPlaceholderGui {
|
||||
}
|
||||
|
||||
e.gui.exit();
|
||||
e.manager.showGUI(e.player, new GUIConfirmBid(this.auctionPlayer, auctionItem));
|
||||
// THE MINIMUM
|
||||
final double minBid = Settings.USE_REALISTIC_BIDDING.getBoolean() ? this.auctionItem.getCurrentPrice() + this.auctionItem.getBidIncrementPrice() : this.auctionItem.getBidIncrementPrice();
|
||||
|
||||
e.manager.showGUI(e.player, new GUIConfirmBid(this.auctionPlayer, auctionItem, minBid));
|
||||
});
|
||||
|
||||
// TODO UPDATE BID
|
||||
@ -110,6 +113,11 @@ public class GUIBid extends AbstractPlaceholderGui {
|
||||
|
||||
double newBiddingAmount = 0;
|
||||
if (Settings.USE_REALISTIC_BIDDING.getBoolean()) {
|
||||
if (value < auctionItem.getCurrentPrice() + auctionItem.getBidIncrementPrice()) {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("pricing.minbidincrementprice").processPlaceholder("price", AuctionAPI.getInstance().formatNumber(auctionItem.getCurrentPrice() + auctionItem.getBidIncrementPrice())).sendPrefixedMessage(e.player);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (value > GUIBid.this.auctionItem.getCurrentPrice()) {
|
||||
newBiddingAmount = value;
|
||||
} else {
|
||||
@ -122,6 +130,11 @@ public class GUIBid extends AbstractPlaceholderGui {
|
||||
newBiddingAmount = GUIBid.this.auctionItem.getCurrentPrice() + value;
|
||||
}
|
||||
} else {
|
||||
if (value < auctionItem.getBidIncrementPrice()) {
|
||||
AuctionHouse.getInstance().getLocale().getMessage("pricing.minbidincrementprice").processPlaceholder("price", AuctionAPI.getInstance().formatNumber(auctionItem.getBidIncrementPrice())).sendPrefixedMessage(e.player);
|
||||
return false;
|
||||
}
|
||||
|
||||
newBiddingAmount = GUIBid.this.auctionItem.getCurrentPrice() + value;
|
||||
}
|
||||
|
||||
@ -181,6 +194,7 @@ public class GUIBid extends AbstractPlaceholderGui {
|
||||
auctionItem.setHighestBidder(e.player.getUniqueId());
|
||||
auctionItem.setHighestBidderName(e.player.getName());
|
||||
auctionItem.setCurrentPrice(newBiddingAmount);
|
||||
|
||||
if (auctionItem.getBasePrice() != -1 && Settings.SYNC_BASE_PRICE_TO_HIGHEST_PRICE.getBoolean() && auctionItem.getCurrentPrice() > auctionItem.getBasePrice()) {
|
||||
auctionItem.setBasePrice(Settings.ROUND_ALL_PRICES.getBoolean() ? Math.round(auctionItem.getCurrentPrice()) : auctionItem.getCurrentPrice());
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ public class GUIConfirmBid extends AbstractPlaceholderGui {
|
||||
private final double bidAmount;
|
||||
private BukkitTask bukkitTask;
|
||||
|
||||
public GUIConfirmBid(AuctionPlayer auctionPlayer, AuctionedItem auctionItem) {
|
||||
this(auctionPlayer, auctionItem, -1);
|
||||
}
|
||||
// public GUIConfirmBid(AuctionPlayer auctionPlayer, AuctionedItem auctionItem) {
|
||||
// this(auctionPlayer, auctionItem, -1);
|
||||
// }
|
||||
|
||||
public GUIConfirmBid(AuctionPlayer auctionPlayer, AuctionedItem auctionItem, double bidAmount) {
|
||||
super(auctionPlayer);
|
||||
|
Loading…
Reference in New Issue
Block a user