mirror of
https://github.com/NLthijs48/AreaShop.git
synced 2024-10-03 09:57:29 +02:00
Add permissions to prevent buying resell regions
- Permission 'areashop.buynormal' can be negated to only allow buying regions that are in resell mode - Permission 'areashop.buyresell' can be negated to only allow buying regions that are not in resell mode This change does not affect existing permissions setups (above permissions are true by default)
This commit is contained in:
parent
f349657a59
commit
5cf5df78c8
@ -258,6 +258,17 @@ public class BuyRegion extends GeneralRegion {
|
||||
plugin.message(player, "general-noEconomy");
|
||||
return false;
|
||||
}
|
||||
if(isInResellingMode()) {
|
||||
if(!player.hasPermission("areashop.buyresell")) {
|
||||
plugin.message(player, "buy-noPermissionResell");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if(!player.hasPermission("areashop.buynormal")) {
|
||||
plugin.message(player, "buy-noPermissionNoResell");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(getWorld() == null) {
|
||||
plugin.message(player, "general-noWorld", getWorldName());
|
||||
return false;
|
||||
|
@ -1814,7 +1814,7 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
|
||||
if(player.hasPermission("areashop.limits." + group) && this.matchesLimitGroup(group)) {
|
||||
int totalLimit = plugin.getConfig().getInt("limitGroups." + group + ".total");
|
||||
int typeLimit = plugin.getConfig().getInt("limitGroups." + group + "."+typePath);
|
||||
AreaShop.debug("typeLimitOther="+typeLimit+", typePath="+typePath);
|
||||
//AreaShop.debug("typeLimitOther="+typeLimit+", typePath="+typePath);
|
||||
int totalCurrent = hasRegionsInLimitGroup(player, group, plugin.getFileManager().getRegions(), exclude);
|
||||
int typeCurrent = 0;
|
||||
if(type == RegionType.RENT) {
|
||||
|
@ -427,7 +427,7 @@ public class RentRegion extends GeneralRegion {
|
||||
return false;
|
||||
}
|
||||
// Check region limits if this is not extending
|
||||
AreaShop.debug("extend="+extend+", config thing="+config.getBoolean("allowRegionExtendsWhenAboveLimits"));
|
||||
//AreaShop.debug("extend="+extend+", config thing="+config.getBoolean("allowRegionExtendsWhenAboveLimits"));
|
||||
if(!(extend && config.getBoolean("allowRegionExtendsWhenAboveLimits"))) {
|
||||
|
||||
LimitResult limitResult = null;
|
||||
|
@ -22,6 +22,8 @@ permissions:
|
||||
areashop.destroybuy: true
|
||||
areashop.rent: true
|
||||
areashop.buy: true
|
||||
areashop.buyresell: true
|
||||
areashop.buynormal: true
|
||||
areashop.unrent: true
|
||||
areashop.info: true
|
||||
areashop.reload: true
|
||||
@ -71,6 +73,12 @@ permissions:
|
||||
areashop.buy:
|
||||
description: Allows you to buy a region
|
||||
default: true
|
||||
areashop.buyresell:
|
||||
description: Allows you to buy a region that is in resell mode
|
||||
default: true
|
||||
areashop.buynormal:
|
||||
description: Allows you to buy a region that is not in resell mode
|
||||
default: true
|
||||
areashop.unrent:
|
||||
description: Allows you to unrent a specific region
|
||||
default: op
|
||||
|
Loading…
Reference in New Issue
Block a user