diff --git a/config.yml b/config.yml index 148edd1..f7996e4 100644 --- a/config.yml +++ b/config.yml @@ -82,6 +82,10 @@ database: # Priority: default < group < player shop-limits: + + # Set whether admin shops should be excluded of the shop limits. + # If set to true, admin shops won't be added to a player's shop count. + exclude-admin-shops: true # Set the amount of shops anyone who's not listed in the sections below can have. # If you don't want the players to have a limit, set the value to -1. diff --git a/src/de/epiceric/shopchest/Commands.java b/src/de/epiceric/shopchest/Commands.java index a051284..7cd739a 100644 --- a/src/de/epiceric/shopchest/Commands.java +++ b/src/de/epiceric/shopchest/Commands.java @@ -202,8 +202,10 @@ public class Commands extends BukkitCommand { if (limit != -1) { if (ShopUtils.getShopAmount(p) >= limit) { - p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_LIMIT_REACHED, new LocalizedMessage.ReplacedRegex(Regex.LIMIT, String.valueOf(limit)))); - return; + if (shopType != ShopType.ADMIN || !Config.exclude_admin_shops) { + p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_LIMIT_REACHED, new LocalizedMessage.ReplacedRegex(Regex.LIMIT, String.valueOf(limit)))); + return; + } } } diff --git a/src/de/epiceric/shopchest/config/Config.java b/src/de/epiceric/shopchest/config/Config.java index 53bed83..ff2c66f 100644 --- a/src/de/epiceric/shopchest/config/Config.java +++ b/src/de/epiceric/shopchest/config/Config.java @@ -40,6 +40,8 @@ public class Config { public static boolean enable_broadcast = plugin.getConfig().getBoolean("enable-broadcast"); + public static boolean exclude_admin_shops = plugin.getConfig().getBoolean("shop-limits.exclude-admin-shops"); + public static double maximal_distance = plugin.getConfig().getDouble("maximal-distance"); public static double shop_creation_price_normal = plugin.getConfig().getDouble("shop-creation-price.normal"); diff --git a/src/de/epiceric/shopchest/utils/ShopUtils.java b/src/de/epiceric/shopchest/utils/ShopUtils.java index 8515c5c..4d28615 100644 --- a/src/de/epiceric/shopchest/utils/ShopUtils.java +++ b/src/de/epiceric/shopchest/utils/ShopUtils.java @@ -152,7 +152,10 @@ public class ShopUtils { int shopCount = 0; for (Shop shop : ShopUtils.getShops()) { - if (shop.getVendor().equals(p)) shopCount++; + if (shop.getVendor().equals(p)) { + if (shop.getShopType() != Shop.ShopType.ADMIN || !Config.exclude_admin_shops) + shopCount++; + } } return shopCount;