From 39d385380240127aba320eeb31ddb4c789488145 Mon Sep 17 00:00:00 2001 From: Acrobot Date: Mon, 31 Dec 2012 02:34:27 +0100 Subject: [PATCH] Does not validate invalid shops --- .../Listeners/PreTransaction/ShopValidator.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/com/Acrobot/ChestShop/Listeners/PreTransaction/ShopValidator.java b/com/Acrobot/ChestShop/Listeners/PreTransaction/ShopValidator.java index 9494a78..5a6781f 100644 --- a/com/Acrobot/ChestShop/Listeners/PreTransaction/ShopValidator.java +++ b/com/Acrobot/ChestShop/Listeners/PreTransaction/ShopValidator.java @@ -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 boolean isEmpty(A[] array) { + for (A element : array) { + if (element != null) { + return false; + } + } + + return true; + } }