mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-12-23 01:21:47 +00:00
Admin shops can be excluded of shop limits
This commit is contained in:
parent
400c4730e5
commit
2b9a2c957f
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user