Skip to content

Commit 17b009a

Browse files
committed
fixed can sell always zero
1 parent b5c4fe9 commit 17b009a

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<artifactId>QuickShop</artifactId>
2626

2727
<properties>
28-
<pluginver>5.0.0.8</pluginver>
28+
<pluginver>5.0.0.9</pluginver>
2929
<package>org.maxgamer.quickshop</package>
3030
<developer>Ghost-chu</developer>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/org/maxgamer/quickshop/listener/PlayerListener.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,21 +300,29 @@ private int getPlayerCanSell(Shop shop, double money, double price, Inventory pl
300300
if (shop.isFreeShop()) {
301301
return Math.min(shop.getRemainingSpace(), Util.countItems(playerInventory, shop.getItem()));
302302
}
303-
int items = shop.getRemainingStock();
303+
304+
int items = Util.countItems(playerInventory, shop.getItem());
305+
Util.debugLog("Items: " + items);
304306
final int ownerCanAfford = (int) (money / price);
307+
Util.debugLog("CanAfford: " + ownerCanAfford);
308+
305309
if (!shop.isUnlimited()) {
306310
// Amount check player amount and shop empty slot
307311
items = Math.min(items, shop.getRemainingSpace());
312+
Util.debugLog("Items: " + items);
308313
// Amount check player selling item total cost and the shop owner's balance
309314
items = Math.min(items, ownerCanAfford);
310-
} else if (plugin.getConfiguration().getBoolean("shop.pay-unlimited-shop-owners")) {
315+
Util.debugLog("Items: " + items);
316+
} else if (plugin.getConfig().getBoolean("shop.pay-unlimited-shop-owners")) {
311317
// even if the shop is unlimited, the config option pay-unlimited-shop-owners is set to
312318
// true,
313319
// the unlimited shop owner should have enough money.
314320
items = Math.min(items, ownerCanAfford);
321+
Util.debugLog("Items: " + items);
315322
}
316323
if (items < 0) {
317324
items = 0;
325+
Util.debugLog("Items: " + items);
318326
}
319327
return items;
320328
}

src/main/java/org/maxgamer/quickshop/shop/ContainerShop.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import net.md_5.bungee.api.chat.ComponentBuilder;
3030
import net.md_5.bungee.api.chat.TextComponent;
3131
import net.md_5.bungee.api.chat.TranslatableComponent;
32-
import net.md_5.bungee.chat.ComponentSerializer;
3332
import org.bukkit.DyeColor;
3433
import org.bukkit.Location;
3534
import org.bukkit.Material;
@@ -783,9 +782,9 @@ public List<ComponentPackage> getSignText(@NotNull String locale) {
783782
}
784783
lines.add(new ComponentPackage(new ComponentBuilder().color(ChatColor.RESET).appendLegacy(line4).create()));
785784

786-
if(Util.isDevMode()) {
787-
lines.forEach(pack -> Util.debugLog(ComponentSerializer.toString(pack.getComponents())));
788-
}
785+
// if(Util.isDevMode()) {
786+
// lines.forEach(pack -> Util.debugLog(ComponentSerializer.toString(pack.getComponents())));
787+
// }
789788

790789
return lines;
791790
}

0 commit comments

Comments
 (0)