From 8069bfd9083da39d3d4e3ea63beb0db53b55707c Mon Sep 17 00:00:00 2001 From: 7sat <49030779+7sat@users.noreply.github.com> Date: Tue, 29 Mar 2022 20:57:01 +0900 Subject: [PATCH] Added API: FindEmptySlot --- pom.xml | 2 +- src/main/java/me/sat7/dynamicshop/DynaShopAPI.java | 11 +++++++++++ .../java/me/sat7/dynamicshop/utilities/ShopUtil.java | 2 -- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index d797964..21af921 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.sat7 DynamicShop - 3.6.2 + 3.6.3 jar DynamicShop diff --git a/src/main/java/me/sat7/dynamicshop/DynaShopAPI.java b/src/main/java/me/sat7/dynamicshop/DynaShopAPI.java index 229bf18..40e7df0 100644 --- a/src/main/java/me/sat7/dynamicshop/DynaShopAPI.java +++ b/src/main/java/me/sat7/dynamicshop/DynaShopAPI.java @@ -415,4 +415,15 @@ public static double QuickSell(Player player, ItemStack itemStack) return Sell.quickSellItem(player, itemStack, ret[0], Integer.parseInt(ret[1]), true, -1); } + + /** + * Search for empty slots in a specific shop. + * + * @param shopName shop name + * @return Returns the index of an empty slot. (first slot only). Returns -1 if there is no empty slot. + */ + public static int FindEmptySlot(String shopName) + { + return ShopUtil.findEmptyShopSlot(shopName, 0, false); + } } diff --git a/src/main/java/me/sat7/dynamicshop/utilities/ShopUtil.java b/src/main/java/me/sat7/dynamicshop/utilities/ShopUtil.java index f803cd4..eb2de88 100644 --- a/src/main/java/me/sat7/dynamicshop/utilities/ShopUtil.java +++ b/src/main/java/me/sat7/dynamicshop/utilities/ShopUtil.java @@ -55,8 +55,6 @@ public static void ReloadAllShop() // 상점에서 빈 슬롯 찾기 public static int findEmptyShopSlot(String shopName, int startIdx, boolean addPage) { - ArrayList banList = new ArrayList<>(); - CustomConfig data = shopConfigFiles.get(shopName); if(data == null) return -1;