diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java index 12226c493..268bc3d9b 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java @@ -251,23 +251,28 @@ public class ShopManager { } } + if (plugin.limit) { int owned = 0; - for (HashMap> shopmap : getShops().values()) { - for (HashMap shopLocs : shopmap.values()) { - for (Shop shop : shopLocs.values()) { - if (shop.getOwner().equals(p.getUniqueId())&&shop.isUnlimited()) { - owned++; + if (!plugin.getConfig().getBoolean("limits.old-algorithm")) { + for (HashMap> shopmap : getShops().values()) { + for (HashMap shopLocs : shopmap.values()) { + for (Shop shop : shopLocs.values()) { + if (shop.getOwner().equals(p.getUniqueId())&&shop.isUnlimited()) { + owned++; + } } } } + }else { + Iterator it = getShopIterator(); + while (it.hasNext()) { + if (it.next().getOwner().equals(p.getUniqueId())) { + owned++; + } + } } -// Iterator it = getShopIterator(); -// while (it.hasNext()) { -// if (it.next().getOwner().equals(p.getUniqueId())) { -// owned++; -// } -// } + int max = plugin.getShopLimit(p); if (owned + 1 > max) { //p.sendMessage(ChatColor.RED + "You have already created a maximum of " + owned + "/" + max + " shops!"); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 9385d160f..5b64c67c2 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -53,6 +53,9 @@ limits: #The default number of shops players can make default: 10 + #Use old algorithm to calc unlimited shops into limits. + old-algorithm: false + #Players with these permissions can create these amounts of shops. ranks: #Anyone with 'quickshop.vip' permissions, can create 20 shops instead of 10. @@ -194,7 +197,7 @@ float: list: - Super Sword(Can't float) #add keywords in there, plugin will check it contain or not on items. -# Ongoing Fee +# Ongoing Fee TODO ongoingfee: enable: false # CheckTime unit is tick (1 seconds = 20 ticks) Do not set low than 600!