From bd2cd07f467819e915f0954c36941b6391ad80a6 Mon Sep 17 00:00:00 2001 From: GJ Date: Thu, 31 Jan 2013 09:00:17 -0500 Subject: [PATCH] Better way to deprecate these. --- .../commands/general/InspectCommand.java | 4 +-- .../com/gmail/nossr50/util/Permissions.java | 28 ++++++++++++------- src/main/resources/plugin.yml | 4 +-- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java b/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java index 147f06283..db57bdaa2 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/InspectCommand.java @@ -30,7 +30,7 @@ public class InspectCommand implements CommandExecutor { if (mcmmoPlayer != null) { Player target = mcmmoPlayer.getPlayer(); - if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !Permissions.inspectDistanceBypass((Player) sender)) { + if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !Permissions.inspectFar((Player) sender)) { sender.sendMessage(LocaleLoader.getString("Inspect.TooFar")); return true; } @@ -44,7 +44,7 @@ public class InspectCommand implements CommandExecutor { return true; } - if (sender instanceof Player && !Permissions.inspectOfflineBypass((Player) sender)) { + if (sender instanceof Player && !Permissions.inspectOffline((Player) sender)) { sender.sendMessage(LocaleLoader.getString("Inspect.Offline")); return true; } diff --git a/src/main/java/com/gmail/nossr50/util/Permissions.java b/src/main/java/com/gmail/nossr50/util/Permissions.java index ec1fb6e0f..2f7c9eb56 100644 --- a/src/main/java/com/gmail/nossr50/util/Permissions.java +++ b/src/main/java/com/gmail/nossr50/util/Permissions.java @@ -35,20 +35,28 @@ public final class Permissions { return hasPermission(player, "mcmmo.bypass.arcanebypass"); } + /** + * @deprecated Use {@link #inspectFar(player)} instead. + */ + @Deprecated public static boolean inspectDistanceBypass(Player player) { - // DEPRECATED PERMISSION - if (hasPermission(player, "mcmmo.bypass.inspect.distance")) - return true; - - return hasPermission(player, "mcmmo.commands.inspect.far"); + return hasPermission(player, "mcmmo.bypass.inspect.distance"); } - public static boolean inspectOfflineBypass(Player player) { - // DEPRECATED PERMISSION - if (hasPermission(player, "mcmmo.bypass.inspect.offline")) - return true; + public static boolean inspectFar(Player player) { + return (hasPermission(player, "mcmmo.commands.inspect.far") || inspectDistanceBypass(player)); + } - return hasPermission(player, "mcmmo.commands.inspect.offline"); + /** + * @deprecated Use {@link #inspectOffline(player)} instead. + */ + @Deprecated + public static boolean inspectOfflineBypass(Player player) { + return hasPermission(player, "mcmmo.bypass.inspect.offline"); + } + + public static boolean inspectOffline(Player player) { + return (hasPermission(player, "mcmmo.commands.inspect.offline") || inspectOfflineBypass(player)); } /* diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d4f0db671..a9f3455ad 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -340,8 +340,8 @@ permissions: mcmmo.tools.all: description: Implies all mcmmo.tools permissions. children: - mcmmo.tools.mcrefresh: true - mcmmo.tools.mmoedit: true + mcmmo.tools.mcrefresh: true + mcmmo.tools.mmoedit: true mcmmo.tools.mcgod: true mcmmo.tools.mcremove: true mcmmo.tools.mcrefresh: