From 98239114adf2e4c6d16c02f5d8550f7ffd98ed73 Mon Sep 17 00:00:00 2001 From: pop4959 Date: Wed, 4 Mar 2020 23:23:23 -0800 Subject: [PATCH] Near exclude permission --- .../src/com/earth2me/essentials/commands/Commandnear.java | 2 +- Essentials/src/plugin.yml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java index cb93f7736..46b446d4f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java @@ -88,7 +88,7 @@ public class Commandnear extends EssentialsCommand { Queue nearbyPlayers = new PriorityQueue<>((o1, o2) -> (int) (o1.getLocation().distanceSquared(loc) - o2.getLocation().distanceSquared(loc))); for (User player : ess.getOnlineUsers()) { - if (!player.equals(user) && (!player.isHidden(user.getBase()) || showHidden || user.getBase().canSee(player.getBase()))) { + if (!player.equals(user) && !player.getBase().hasPermission("essentials.near.exclude") && (!player.isHidden(user.getBase()) || showHidden || user.getBase().canSee(player.getBase()))) { final Location playerLoc = player.getLocation(); if (playerLoc.getWorld() != world) { continue; diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index fd413857f..8f5d22979 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -564,3 +564,6 @@ permissions: essentials.keepinv: default: false description: Controls whether players keep their inventory on death. + essentials.near.exclude: + default: false + description: If the player should be excluded from near lookups.