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

@ -83,6 +83,10 @@ database:
# Priority: default < group < player # Priority: default < group < player
shop-limits: 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. # 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. # If you don't want the players to have a limit, set the value to -1.
default: 5 default: 5

View File

@ -202,10 +202,12 @@ public class Commands extends BukkitCommand {
if (limit != -1) { if (limit != -1) {
if (ShopUtils.getShopAmount(p) >= limit) { if (ShopUtils.getShopAmount(p) >= limit) {
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)))); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_LIMIT_REACHED, new LocalizedMessage.ReplacedRegex(Regex.LIMIT, String.valueOf(limit))));
return; return;
} }
} }
}
try { try {
amount = Integer.parseInt(args[1]); amount = Integer.parseInt(args[1]);

View File

@ -40,6 +40,8 @@ public class Config {
public static boolean enable_broadcast = plugin.getConfig().getBoolean("enable-broadcast"); 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 maximal_distance = plugin.getConfig().getDouble("maximal-distance");
public static double shop_creation_price_normal = plugin.getConfig().getDouble("shop-creation-price.normal"); 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; int shopCount = 0;
for (Shop shop : ShopUtils.getShops()) { 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; return shopCount;