mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-01-23 15:21:20 +01:00
🪲 Fix regarding infinite items losing their original stack size. Possibly resolves #24, needs confirmation
Took 4 minutes
This commit is contained in:
parent
6895ed8a89
commit
dc0dd49560
@ -157,14 +157,12 @@ public class GUIConfirmPurchase extends AbstractPlaceholderGui {
|
|||||||
ItemStack item = auctionItem.getItem().clone();
|
ItemStack item = auctionItem.getItem().clone();
|
||||||
ItemStack toGive = auctionItem.getItem().clone();
|
ItemStack toGive = auctionItem.getItem().clone();
|
||||||
|
|
||||||
if (item.getAmount() - this.purchaseQuantity >= 1) {
|
if (item.getAmount() - this.purchaseQuantity >= 1 && !located.isInfinite()) {
|
||||||
item.setAmount(item.getAmount() - this.purchaseQuantity);
|
item.setAmount(item.getAmount() - this.purchaseQuantity);
|
||||||
toGive.setAmount(this.purchaseQuantity);
|
toGive.setAmount(this.purchaseQuantity);
|
||||||
|
|
||||||
if (!located.isInfinite()) {
|
|
||||||
located.setItem(item);
|
located.setItem(item);
|
||||||
located.setBasePrice(Settings.ROUND_ALL_PRICES.getBoolean() ? Math.round(located.getBasePrice() - buyNowPrice) : located.getBasePrice() - buyNowPrice);
|
located.setBasePrice(Settings.ROUND_ALL_PRICES.getBoolean() ? Math.round(located.getBasePrice() - buyNowPrice) : located.getBasePrice() - buyNowPrice);
|
||||||
}
|
|
||||||
|
|
||||||
transferFunds(e.player, buyNowPrice);
|
transferFunds(e.player, buyNowPrice);
|
||||||
} else {
|
} else {
|
||||||
@ -209,12 +207,13 @@ public class GUIConfirmPurchase extends AbstractPlaceholderGui {
|
|||||||
.sendPrefixedMessage(player));
|
.sendPrefixedMessage(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AuctionHouse.getInstance().getTransactionManager().getPrePurchasePlayers(auctionItem.getId()).forEach(player -> {
|
AuctionHouse.getInstance().getTransactionManager().getPrePurchasePlayers(auctionItem.getId()).forEach(player -> {
|
||||||
AuctionHouse.getInstance().getTransactionManager().removeAllRelatedPlayers(auctionItem.getId());
|
AuctionHouse.getInstance().getTransactionManager().removeAllRelatedPlayers(auctionItem.getId());
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
});
|
});
|
||||||
|
|
||||||
e.gui.close();
|
e.gui.close();
|
||||||
|
|
||||||
} catch (ItemNotFoundException exception) {
|
} catch (ItemNotFoundException exception) {
|
||||||
AuctionHouse.getInstance().getLogger().info("Tried to purchase item that was bought, or does not exist");
|
AuctionHouse.getInstance().getLogger().info("Tried to purchase item that was bought, or does not exist");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user