mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-24 02:56:02 +01:00
Added protection from buy and sell prices == 0
Also fixed the formattedItem NPE.
This commit is contained in:
parent
45fa6d5c75
commit
ac71113f3e
@ -106,6 +106,11 @@ public class SignChange implements Listener {
|
||||
double buyPrice = PriceUtil.getBuyPrice(formattedPrice);
|
||||
double sellPrice = PriceUtil.getSellPrice(formattedPrice);
|
||||
|
||||
if (buyPrice == 0 && sellPrice == 0) {
|
||||
sendMessageAndExit(YOU_CANNOT_CREATE_SHOP, event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isAdmin && (!canCreateShop(player, stock.getType(), buyPrice, sellPrice) || !MaxPrice.canCreate(buyPrice, sellPrice, stock.getType()))) {
|
||||
sendMessageAndExit(YOU_CANNOT_CREATE_SHOP, event);
|
||||
return;
|
||||
@ -228,7 +233,9 @@ public class SignChange implements Listener {
|
||||
formatted = formatted.substring(0, (15 - data.length()));
|
||||
}
|
||||
|
||||
if (MaterialUtil.getItem(formatted).getType() != item.getType()) {
|
||||
ItemStack formattedItem = MaterialUtil.getItem(formatted);
|
||||
|
||||
if (formattedItem == null || formattedItem.getType() != item.getType()) {
|
||||
formatted = String.valueOf(item.getTypeId());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user