mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-01-21 22:31:20 +01:00
Fix NPE in StockCounter for admin shops/missing containers
This commit is contained in:
parent
7a1c091c74
commit
4bd443c69f
@ -10,6 +10,7 @@ import com.Acrobot.ChestShop.Events.TransactionEvent;
|
||||
import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
||||
import com.Acrobot.ChestShop.Utils.uBlock;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Container;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -55,9 +56,10 @@ public class StockCounterModule implements Listener {
|
||||
|
||||
ItemStack itemTradedByShop = determineItemTradedByShop(event.getSignLine(ITEM_LINE));
|
||||
if (itemTradedByShop != null) {
|
||||
Inventory chestShopInventory = uBlock.findConnectedContainer(event.getSign()).getInventory();
|
||||
|
||||
event.setSignLine(QUANTITY_LINE, getQuantityLineWithCounter(quantity, itemTradedByShop, chestShopInventory));
|
||||
Container container = uBlock.findConnectedContainer(event.getSign());
|
||||
if (container != null) {
|
||||
event.setSignLine(QUANTITY_LINE, getQuantityLineWithCounter(quantity, itemTradedByShop, container.getInventory()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user