From 5b11175cf3ee17d6db29db6486ebdf098e84d392 Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Sun, 1 Nov 2020 22:16:23 +0100 Subject: [PATCH] Add plots.visit.denied permission --- Bukkit/src/main/resources/plugin.yml | 2 ++ Core/src/main/java/com/plotsquared/core/command/Visit.java | 7 +++++++ .../java/com/plotsquared/core/permissions/Permission.java | 1 + 3 files changed, 10 insertions(+) diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index 91579acdb..bd5328e27 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -141,6 +141,8 @@ permissions: default: false plots.visit.other: default: false + plots.visit.denied: + default: false plots.home: default: false plots.alias.remove: 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 b75182ee0..031cb5fc9 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Visit.java +++ b/Core/src/main/java/com/plotsquared/core/command/Visit.java @@ -135,6 +135,13 @@ public class Visit extends Command { Templates.of("node", "plots.admin.visit.untrusted")); return; } + if (plot.isDenied(player.getUUID())) { + if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_DENIED)) { + player.sendMessage(TranslatableCaption.of("permission.no_permission"), + Template.of("node", "plots.visit.denied")); + return; + } + } } confirm.run(this, () -> plot.teleportPlayer(player, TeleportCause.COMMAND, result -> { diff --git a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java index dc8604c60..cf1d78a75 100644 --- a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java +++ b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java @@ -147,6 +147,7 @@ public enum Permission { PERMISSION_VISIT_UNOWNED("plots.visit.unowned"), PERMISSION_VISIT_OWNED("plots.visit.owned"), PERMISSION_SHARED("plots.visit.shared"), + PERMISSION_VISIT_DENIED("plots.visit.denied"), PERMISSION_VISIT_OTHER("plots.visit.other"), PERMISSION_HOME("plots.home"), PERMISSION_ALIAS_SET("plots.alias.set"),