From 7263290bbe23d66110e87e03de4843b084fdeef7 Mon Sep 17 00:00:00 2001 From: mindw0rm Date: Tue, 2 Nov 2021 14:28:39 +0100 Subject: [PATCH] fix: Untrusted visit flag not working with untrusted visit permission Fixes #3317 Co-authored-by: Alex --- .../java/com/plotsquared/core/command/Visit.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Visit.java b/Core/src/main/java/com/plotsquared/core/command/Visit.java index 84aa179d4..6a19e089e 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Visit.java +++ b/Core/src/main/java/com/plotsquared/core/command/Visit.java @@ -140,21 +140,16 @@ public class Visit extends Command { return; } } else { - if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OTHER)) { + // allow visit, if UntrustedVisit flag is set, or if the player has either the plot.visit.other or + // plot.admin.visit.untrusted permission + if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions.hasPermission(player, Permission.PERMISSION_VISIT_OTHER) + && !Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), Templates.of("node", "plots.visit.other") ); return; } - if (!plot.getFlag(UntrustedVisitFlag.class) && !Permissions - .hasPermission(player, Permission.PERMISSION_ADMIN_VISIT_UNTRUSTED)) { - player.sendMessage( - TranslatableCaption.of("permission.no_permission"), - Templates.of("node", "plots.admin.visit.untrusted") - ); - return; - } if (plot.isDenied(player.getUUID())) { if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_DENIED)) { player.sendMessage(