Further updating the permissions for the /mcrank command.

This commit is contained in:
Glitchfinder 2013-02-03 13:35:36 -08:00
parent b01d80b1f4
commit 93ffd950e9
2 changed files with 35 additions and 1 deletions

View File

@ -8,11 +8,15 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.McRankAsync; import com.gmail.nossr50.runnables.McRankAsync;
import com.gmail.nossr50.skills.utilities.SkillTools; import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType; import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.Leaderboard; import com.gmail.nossr50.util.Leaderboard;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class McrankCommand implements CommandExecutor { public class McrankCommand implements CommandExecutor {
@Override @Override
@ -44,6 +48,22 @@ public class McrankCommand implements CommandExecutor {
} }
playerName = args[0]; playerName = args[0];
McMMOPlayer mcmmoPlayer = Users.getPlayer(playerName);
if (mcmmoPlayer != null) {
Player target = mcmmoPlayer.getPlayer();
if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !Permissions.hasPermission(sender, "mcmmo.commands.mcrank.others.far")) {
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
return true;
}
}
else if (sender instanceof Player && !Permissions.hasPermission(sender, "mcmmo.commands.mcrank.others.offline")) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true;
}
break; break;
default: default:

View File

@ -715,7 +715,7 @@ permissions:
mcmmo.commands.mcgod: true mcmmo.commands.mcgod: true
mcmmo.commands.mcgod.others: true mcmmo.commands.mcgod.others: true
mcmmo.commands.mcpurge: true mcmmo.commands.mcpurge: true
mcmmo.commands.mcrank.others: true mcmmo.commands.mcrank.others.all: true
mcmmo.commands.mmoedit: true mcmmo.commands.mmoedit: true
mcmmo.commands.mmoedit.others: true mcmmo.commands.mmoedit.others: true
mcmmo.commands.mmoupdate: true mcmmo.commands.mmoupdate: true
@ -774,8 +774,22 @@ permissions:
description: Allows access to the mcpurge command description: Allows access to the mcpurge command
mcmmo.commands.mcrank: mcmmo.commands.mcrank:
description: Allows access to the mcrank command description: Allows access to the mcrank command
mcmmo.commands.mcrank.others.*:
description: Implies access to all mcmmo.commands.mcrank.others permissions
children:
mcmmo.commands.mcrank.others.all: true
mcmmo.commands.mcrank.others.all:
description: Implies access to all mcmmo.commands.mcrank.others permissions
children:
mcmmo.commands.mcrank.others: true
mcmmo.commands.mcrank.others.far: true
mcmmo.commands.mcrank.others.offline: true
mcmmo.commands.mcrank.others: mcmmo.commands.mcrank.others:
description: Allows access to the mcrank command for other players description: Allows access to the mcrank command for other players
mcmmo.commands.mcrank.others.far:
description: Allows access to the mcrank command for far players
mcmmo.commands.mcrank.others.offline:
description: Allows access to the mcrank command for offline players
mcmmo.commands.mcstats: mcmmo.commands.mcstats:
description: Allows access to the mcstats command description: Allows access to the mcstats command
mcmmo.commands.mctop: mcmmo.commands.mctop: