🔢 Fix negative bidding

Took 3 minutes
This commit is contained in:
Kiran Hart 2023-04-07 15:15:28 -04:00
parent 9e02748911
commit 768e234c88
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
3 changed files with 13 additions and 2 deletions

View File

@ -277,12 +277,17 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
string = ChatColor.stripColor(string);
if (!NumberUtils.isDouble(string)) {
AuctionHouse.getInstance().getLocale().getMessage("general.notanumber").processPlaceholder("value", string).sendPrefixedMessage(player);
AuctionHouse.getInstance().getLocale().getMessage("general.notanumber").processPlaceholder("value", string).sendPrefixedMessage(player);
return false;
}
double value = Double.parseDouble(string);
if (value <= 0) {
AuctionHouse.getInstance().getLocale().getMessage("general.cannotbezero").sendPrefixedMessage(e.player);
return false;
}
if (value > Settings.MAX_AUCTION_INCREMENT_PRICE.getDouble()) {
AuctionHouse.getInstance().getLocale().getMessage("pricing.maxbidincrementprice").processPlaceholder("price", Settings.MAX_AUCTION_INCREMENT_PRICE.getDouble()).sendPrefixedMessage(e.player);
return false;

View File

@ -92,12 +92,17 @@ public class GUIBid extends AbstractPlaceholderGui {
string = ChatColor.stripColor(string);
if (!NumberUtils.isDouble(string)) {
AuctionHouse.getInstance().getLocale().getMessage("general.notanumber").processPlaceholder("value", string).sendPrefixedMessage(player);
AuctionHouse.getInstance().getLocale().getMessage("general.notanumber").processPlaceholder("value", string).sendPrefixedMessage(player);
return false;
}
double value = Double.parseDouble(string);
if (value <= 0) {
AuctionHouse.getInstance().getLocale().getMessage("general.cannotbezero").sendPrefixedMessage(e.player);
return false;
}
if (value > Settings.MAX_AUCTION_INCREMENT_PRICE.getDouble()) {
AuctionHouse.getInstance().getLocale().getMessage("pricing.maxbidincrementprice").processPlaceholder("price", Settings.MAX_AUCTION_INCREMENT_PRICE.getDouble()).sendPrefixedMessage(e.player);
return false;

View File

@ -43,6 +43,7 @@ public class LocaleSettings {
languageNodes.put("general.locked", "&cThe Auction House is currently locked!");
languageNodes.put("general.playernotfound", "&cCould not find the player &4%player%");
languageNodes.put("general.notenoughmoney", "&cYou do not have enough money!");
languageNodes.put("general.cannotbezero", "&cPlease provide a number greater than zero");
languageNodes.put("general.cantbidonown", "&cYou cannot bid on your own item!");
languageNodes.put("general.alreadyhighestbidder", "&cYou are already the highest bidder!");
languageNodes.put("general.cantbuyown", "&cYou cannot buy your own item!");