Skip to content

Commit

Permalink
Fix #100
Browse files Browse the repository at this point in the history
Add check to see if shop is present before selling.
  • Loading branch information
noahbclarkson committed Oct 17, 2022
1 parent 35bac77 commit 875d61f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/unprotesting/com/github/commands/SellCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import unprotesting.com.github.AutoTune;
import unprotesting.com.github.config.Config;
import unprotesting.com.github.data.PurchaseUtil;
import unprotesting.com.github.data.Shop;
import unprotesting.com.github.data.ShopUtil;
import unprotesting.com.github.util.EconomyUtil;
import unprotesting.com.github.util.Format;
Expand Down Expand Up @@ -49,8 +50,15 @@ private boolean interpret(@NotNull Player player) {
continue;
}

String itemName = item.getType().toString().toLowerCase();
Shop shop = ShopUtil.getShop(itemName);

if (shop == null) {
continue;
}

if (isSellLimits) {
int sellsLeft = ShopUtil.getSellsLeft(player, item.getType().toString().toLowerCase());
int sellsLeft = ShopUtil.getSellsLeft(player, itemName);
int itemAmount = item.getAmount();
int amountCantSell = itemAmount - sellsLeft;

Expand Down

0 comments on commit 875d61f

Please sign in to comment.