mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 11:16:02 +00:00
Prevent Overbidding on Auctions
This commit is contained in:
1 parent
0eec52f6d9
commit
5d4d21359f
4 files changed
+16
-2
No files matched your search
@@ -126,7 +126,7 @@ public class GuiAuctionBidding extends GuiAuctionInterface implements ISubGuiLis
|
||||
private void openBidSubGui() {
|
||||
if (listing == null) return;
|
||||
long minBid = listing.getMinimumBid(AuctionClientConfig.getMinBidIncrement());
|
||||
setSubGui(new SubGuiAuctionBid(listing.id, minBid, playerBalance));
|
||||
setSubGui(new SubGuiAuctionBid(listing.id, minBid, listing.buyoutPrice, playerBalance));
|
||||
}
|
||||
|
||||
private void openBuyNowSubGui() {
|
||||
|
||||
@@ -23,14 +23,16 @@ public class SubGuiAuctionBid extends SubGuiInterface implements ITextfieldListe
|
||||
|
||||
private final String listingId;
|
||||
private final long minimumBid;
|
||||
private final long buyoutPrice;
|
||||
private final long playerBalance;
|
||||
private long bidAmount;
|
||||
private boolean successful = false;
|
||||
private String errorMessage = null;
|
||||
|
||||
public SubGuiAuctionBid(String listingId, long minimumBid, long playerBalance) {
|
||||
public SubGuiAuctionBid(String listingId, long minimumBid, long buyoutPrice, long playerBalance) {
|
||||
this.listingId = listingId;
|
||||
this.minimumBid = minimumBid;
|
||||
this.buyoutPrice = buyoutPrice;
|
||||
this.playerBalance = playerBalance;
|
||||
this.bidAmount = minimumBid;
|
||||
|
||||
@@ -129,6 +131,12 @@ public class SubGuiAuctionBid extends SubGuiInterface implements ITextfieldListe
|
||||
return;
|
||||
}
|
||||
|
||||
if (buyoutPrice > 0 && bidAmount >= buyoutPrice) {
|
||||
errorMessage = StatCollector.translateToLocal("auction.error.bidExceedsBuyout");
|
||||
updateErrorLabel();
|
||||
return;
|
||||
}
|
||||
|
||||
// Send bid packet
|
||||
AuctionActionPacket.placeBid(listingId, bidAmount);
|
||||
successful = true;
|
||||
|
||||
Reference in new issue
Block a user