Added permission node to prevent inspecting hidden players

This commit is contained in:
TfT_02 2013-06-02 12:42:18 +02:00 committed by GJ
parent da25b02e0a
commit 375fa4f75c
5 changed files with 25 additions and 0 deletions

View File

@ -28,6 +28,7 @@ Version 1.4.06-dev
+ Added multiplier to Archery XP based on bow force
+ Added information about /party itemshare and /party expshare to the party help page
+ Added option to use scoreboards for power level display instead of Spout.
+ Added permission node to prevent inspecting hidden players
= Fixed bug where custom Spout titles were overwritten by mcMMO.
= Fixed bug where Nether Quartz wasn't included in Smelting or item sharing
= Fixed bug where players were able to join the same party multiple times

View File

@ -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;

View File

@ -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"); }

View File

@ -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;

View File

@ -612,6 +612,7 @@ permissions:
mcmmo.bypass.hardcoremode: true
mcmmo.bypass.kraken: true
mcmmo.commands.inspect.far: true
mcmmo.commands.inspect.hidden: true
mcmmo.commands.inspect.offline: true
mcmmo.bypass.arcanebypass:
default: false
@ -627,6 +628,11 @@ permissions:
description: Allows user to bypass Inspect's distance requirements
children:
mcmmo.commands.inspect.far: true
mcmmo.bypass.inspect.hidden:
default: false
description: Allows user to bypass Inspect's hidden player requirements
children:
mcmmo.commands.inspect.hidden: true
mcmmo.bypass.inspect.offline:
default: false
description: Allows user to bypass Inspect's offline player requirements
@ -701,6 +707,7 @@ permissions:
mcmmo.commands.defaults: true
mcmmo.commands.hardcore.all: true
mcmmo.commands.inspect.far: true
mcmmo.commands.inspect.hidden: true
mcmmo.commands.inspect.offline: true
mcmmo.commands.kraken: true
mcmmo.commands.kraken.others: true
@ -772,11 +779,14 @@ permissions:
children:
mcmmo.commands.inspect: true
mcmmo.commands.inspect.far: true
mcmmo.commands.inspect.hidden: true
mcmmo.commands.inspect.offline: true
mcmmo.commands.inspect:
description: Allows access to the inspect command
mcmmo.commands.inspect.far:
description: Allows access to the inspect command for far players
mcmmo.commands.inspect.hidden:
description: Allows access to the inspect command for hidden players
mcmmo.commands.inspect.offline:
description: Allows access to the inspect command for offline players
mcmmo.commands.kraken: