From 5315e1e3379a20e7bb6c1e73f281ea2f4057745b Mon Sep 17 00:00:00 2001 From: mindw0rm Date: Thu, 10 Oct 2019 20:12:15 +0200 Subject: [PATCH] let untrusted-visit override deny-teleport --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index f2e8f363a..909b26214 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -697,7 +697,11 @@ import java.util.regex.Pattern; Plot plot = area.getPlot(location); if (plot != null) { final boolean result = Flags.DENY_TELEPORT.allowsTeleport(plotPlayer, plot); - if (!result) { + // there is one possibility to still allow teleportation: + // to is identical to the plot's home location, and untrusted-visit is true + // i.e. untrusted-visit can override deny-teleport + // this is acceptable, because otherwise it wouldn't make sense to have both flags set + if (!result && !(Flags.UNTRUSTED_VISIT.isTrue(plot) && plot.getHome().equals(location))) { MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_ENTRY_DENIED); event.setCancelled(true);