This commit is contained in:
Bruno Rybársky 2024-08-21 16:02:16 +02:00
parent 81e3fbd5fe
commit 792336812b
2 changed files with 3 additions and 3 deletions

@ -6,7 +6,7 @@ minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3 yarn_mappings=1.21.1+build.3
loader_version=0.16.2 loader_version=0.16.2
# Mod Properties # Mod Properties
mod_version=1.4.3 mod_version=1.4.4
maven_group=systems.brn maven_group=systems.brn
archives_base_name=servershop archives_base_name=servershop
# Dependencies # Dependencies

@ -58,7 +58,7 @@ public class AuctionStorage {
seller.sendMessage(Text.translatable("message.servershop.sell.not_enough"), true); seller.sendMessage(Text.translatable("message.servershop.sell.not_enough"), true);
} else { } else {
seller.sendMessage(Text.translatable("message.servershop.sell.auction", soldCount, itemStack.getName(), price), true); seller.sendMessage(Text.translatable("message.servershop.sell.auction", soldCount, itemStack.getName(), price), true);
if(fromCursorStack) { if (fromCursorStack) {
itemStack.setCount(0); itemStack.setCount(0);
} }
auctions.add(new AuctionRecord(price, sellingStack, seller.getUuid())); auctions.add(new AuctionRecord(price, sellingStack, seller.getUuid()));
@ -75,7 +75,7 @@ public class AuctionStorage {
int buyPrice = auction.buyPrice() * itemStack.getCount(); int buyPrice = auction.buyPrice() * itemStack.getCount();
long playerBalance = balanceStorage.getBalance(buyer); long playerBalance = balanceStorage.getBalance(buyer);
if (buyPrice > 0 && auctions.contains(auction)) { if (buyPrice > 0 && auctions.contains(auction)) {
if (playerBalance >= buyPrice) { if (playerBalance >= buyPrice || buyer.getUuid().equals(auction.sellerUUID())) {
if (canInsertItemIntoInventory(playerInventory, itemStack.copy()) >= itemStack.getCount()) { if (canInsertItemIntoInventory(playerInventory, itemStack.copy()) >= itemStack.getCount()) {
ItemStack remaining = insertStackIntoInventory(playerInventory, itemStack.copy()); ItemStack remaining = insertStackIntoInventory(playerInventory, itemStack.copy());
int toDeduce = buyPrice - (auction.buyPrice() * remaining.getCount()); int toDeduce = buyPrice - (auction.buyPrice() * remaining.getCount());