Better way to deprecate these.

This commit is contained in:
GJ 2013-01-31 09:00:17 -05:00
parent cd35df17ec
commit bd2cd07f46
3 changed files with 22 additions and 14 deletions

View File

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

View File

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