Permissions for stat displays

This commit is contained in:
T00thpick1 2013-03-10 15:45:25 -04:00
parent d78a1efbf6
commit 8059636b62
3 changed files with 15 additions and 5 deletions

View File

@ -98,6 +98,10 @@ public class McrankCommand implements CommandExecutor {
continue;
}
if ((sender instanceof Player) && !Permissions.skillEnabled((Player) sender, skillType)) {
continue;
}
if (rankInts[1] == 0) {
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillUtils.getSkillName(skillType), LocaleLoader.getString("Commands.mcrank.Unranked"))); // Don't bother showing ranking for players without skills
}

View File

@ -72,6 +72,11 @@ public class MctopCommand implements CommandExecutor {
}
private void display(int page, String skill, CommandSender sender, boolean sql, Command command) {
if (!skill.equalsIgnoreCase("all") && !Permissions.mctop(sender, SkillType.getSkill(skill))) {
sender.sendMessage(command.getPermissionMessage());
return;
}
if (sql) {
if (skill.equalsIgnoreCase("all")) {
sqlDisplay(page, "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing", sender, command);
@ -86,11 +91,6 @@ public class MctopCommand implements CommandExecutor {
}
private void flatfileDisplay(int page, String skill, CommandSender sender, Command command) {
if (!skill.equalsIgnoreCase("all") && !Permissions.mctop(sender, SkillType.getSkill(skill))) {
sender.sendMessage(command.getPermissionMessage());
return;
}
LeaderboardManager.updateLeaderboards(); // Make sure we have the latest information
String[] info = LeaderboardManager.retrieveInfo(skill, page);

View File

@ -3,11 +3,13 @@ package com.gmail.nossr50.runnables.commands;
import java.util.Map;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillUtils;
public class McrankCommandAsyncTask implements Runnable {
@ -34,6 +36,10 @@ public class McrankCommandAsyncTask implements Runnable {
continue;
}
if ((sender instanceof Player) && !Permissions.skillEnabled((Player) sender, skillType)) {
continue;
}
if (skills.get(skillType.name()) == null) {
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", SkillUtils.getSkillName(skillType), LocaleLoader.getString("Commands.mcrank.Unranked")));
}