Does not validate invalid shops

This commit is contained in:
Acrobot 2012-12-31 02:34:27 +01:00
parent 2fca493dec
commit 39d3853802
1 changed files with 15 additions and 0 deletions

View File

@ -18,8 +18,23 @@ public class ShopValidator implements Listener {
return;
}
if (isEmpty(event.getStock())) {
event.setCancelled(INVALID_SHOP);
return;
}
if (!ChestShopSign.isAdminShop(event.getSign()) && event.getOwnerInventory() == null) {
event.setCancelled(INVALID_SHOP);
}
}
private static <A> boolean isEmpty(A[] array) {
for (A element : array) {
if (element != null) {
return false;
}
}
return true;
}
}