Admin shops can be excluded of shop limits

This commit is contained in:
Eric Biedert 2016-06-24 18:13:33 +02:00
parent 400c4730e5
commit 2b9a2c957f
4 changed files with 14 additions and 3 deletions

View File

@ -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.

View File

@ -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;
}
}
}

View File

@ -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");

View File

@ -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;