/as add: fix setting player as landlord when he is an owner of the region

- Fixes #427
- Adds a debug message to check the behavior easily in the future
This commit is contained in:
Thijs Wiefferink 2018-12-28 17:11:37 +01:00
parent c7299fa56c
commit 44b1cb0fc8

View File

@ -130,7 +130,7 @@ public class AddCommand extends CommandAreaShop {
ProtectedRegion region = regionEntry.getValue(); ProtectedRegion region = regionEntry.getValue();
// Determine if the player is an owner or member of the region // Determine if the player is an owner or member of the region
boolean isMember = finalPlayer != null && plugin.getWorldGuardHandler().containsMember(region, finalPlayer.getUniqueId()); boolean isMember = finalPlayer != null && plugin.getWorldGuardHandler().containsMember(region, finalPlayer.getUniqueId());
boolean isOwner = finalPlayer != null && plugin.getWorldGuardHandler().containsMember(region, finalPlayer.getUniqueId()); boolean isOwner = finalPlayer != null && plugin.getWorldGuardHandler().containsOwner(region, finalPlayer.getUniqueId());
String type; String type;
if(isRent) { if(isRent) {
type = "rent"; type = "rent";
@ -154,6 +154,16 @@ public class AddCommand extends CommandAreaShop {
List<UUID> existing = new ArrayList<>(); List<UUID> existing = new ArrayList<>();
existing.addAll(plugin.getWorldGuardHandler().getOwners(region).asUniqueIdList()); existing.addAll(plugin.getWorldGuardHandler().getOwners(region).asUniqueIdList());
existing.addAll(plugin.getWorldGuardHandler().getMembers(region).asUniqueIdList()); existing.addAll(plugin.getWorldGuardHandler().getMembers(region).asUniqueIdList());
AreaShop.debug("regionAddLandlordStatus:", regionName,
"landlord:", landlord,
"existing:", existing,
"isMember:", isMember,
"isOwner:", isOwner,
"createPermission:", sender.hasPermission("areashop.create" + type),
"ownerPermission:", sender.hasPermission("areashop.create" + type + ".owner"),
"memberPermission:", sender.hasPermission("areashop.create" + type + ".member"));
if(isRent) { if(isRent) {
RentRegion rent = new RentRegion(regionName, world); RentRegion rent = new RentRegion(regionName, world);
// Set landlord // Set landlord