From 44b1cb0fc829b085b8b560e03ba81e07de3cbe06 Mon Sep 17 00:00:00 2001 From: Thijs Wiefferink Date: Fri, 28 Dec 2018 17:11:37 +0100 Subject: [PATCH] /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 --- .../me/wiefferink/areashop/commands/AddCommand.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/AreaShop/src/main/java/me/wiefferink/areashop/commands/AddCommand.java b/AreaShop/src/main/java/me/wiefferink/areashop/commands/AddCommand.java index d3ab74e..243e659 100644 --- a/AreaShop/src/main/java/me/wiefferink/areashop/commands/AddCommand.java +++ b/AreaShop/src/main/java/me/wiefferink/areashop/commands/AddCommand.java @@ -130,7 +130,7 @@ public class AddCommand extends CommandAreaShop { ProtectedRegion region = regionEntry.getValue(); // Determine if the player is an owner or member of the region 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; if(isRent) { type = "rent"; @@ -154,6 +154,16 @@ public class AddCommand extends CommandAreaShop { List existing = new ArrayList<>(); existing.addAll(plugin.getWorldGuardHandler().getOwners(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) { RentRegion rent = new RentRegion(regionName, world); // Set landlord