mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 02:04:44 +02:00
Added permission node to prevent inspecting hidden players
This commit is contained in:
@ -73,6 +73,10 @@ public class InspectCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && Config.getInstance().getInspectScoreboardEnabled()) {
|
||||
ScoreboardManager.enablePlayerInspectScoreboardOnline((Player) sender, mcMMOPlayer);
|
||||
return true;
|
||||
|
@ -48,6 +48,7 @@ public final class Permissions {
|
||||
|
||||
public static boolean inspect(Permissible permissible) { return (permissible.hasPermission("mcmmo.commands.inspect")); }
|
||||
public static boolean inspectFar(Permissible permissible) { return (permissible.hasPermission("mcmmo.commands.inspect.far")); }
|
||||
public static boolean inspectHidden(Permissible permissible) { return (permissible.hasPermission("mcmmo.commands.inspect.hidden")); }
|
||||
public static boolean inspectOffline(Permissible permissible) { return (permissible.hasPermission("mcmmo.commands.inspect.offline")); }
|
||||
|
||||
public static boolean kraken(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.kraken"); }
|
||||
|
@ -55,6 +55,15 @@ public final class CommandUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hidden(CommandSender sender, Player target, boolean hasPermission) {
|
||||
if (sender instanceof Player && ((Player)sender).canSee(target) && !hasPermission) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean noConsoleUsage(CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user