From 57c8c94db7ce73073adfea4f88e6f000fed0d012 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Sun, 3 Feb 2013 14:17:40 -0800 Subject: [PATCH] Updating the permissions for the /mctop command. --- .../nossr50/commands/player/MctopCommand.java | 9 ++++ src/main/resources/plugin.yml | 51 +++++++++++++++++-- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java b/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java index ed0740842..e7e5a75b6 100644 --- a/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java @@ -120,6 +120,10 @@ public class MctopCommand implements CommandExecutor { } private void flatfileDisplay(int page, String skill, CommandSender sender) { + if (!skill.equalsIgnoreCase("all") && CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mctop." + skill.toLowerCase())) { + return; + } + Leaderboard.updateLeaderboards(); //Make sure we have the latest information SkillType skillType = SkillType.getSkill(skill); String[] info = Leaderboard.retrieveInfo(skillType, page); @@ -152,6 +156,11 @@ public class MctopCommand implements CommandExecutor { } private void sqlDisplay(int page, String query, CommandSender sender) { + if (!query.equalsIgnoreCase("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) { + if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mctop." + query.toLowerCase())) { + return; + } + } String tablePrefix = Config.getInstance().getMySQLTablePrefix(); HashMap> userslist = Database.read("SELECT " + query + ", user, NOW() FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON (user_id = id) WHERE " + query + " > 0 ORDER BY " + query + " DESC, user LIMIT "+((page * 10) - 10)+",10"); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index e9fe24e5b..63d6445f0 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -737,7 +737,7 @@ permissions: mcmmo.commands.mcmmo: true mcmmo.commands.mcrank: true mcmmo.commands.mcstats: true - mcmmo.commands.mctop: true + mcmmo.commands.mctop.all: true mcmmo.commands.party.all: true mcmmo.commands.ptp: true mcmmo.commands.ability: @@ -806,8 +806,55 @@ permissions: description: Allows access to the mcremove command mcmmo.commands.mcstats: description: Allows access to the mcstats command + mcmmo.commands.mctop.*: + description: Implies access to all mcmmo.commands.mctop permissions + children: + mcmmo.commands.mctop.all: true + mcmmo.commands.mctop.all: + description: Implies access to all mcmmo.commands.mctop permissions + children: + mcmmo.commands.mctop: true + mcmmo.commands.mctop.acrobatics: true + mcmmo.commands.mctop.archery: true + mcmmo.commands.mctop.axes: true + mcmmo.commands.mctop.excavation: true + mcmmo.commands.mctop.fishing: true + mcmmo.commands.mctop.herbalism: true + mcmmo.commands.mctop.mining: true + mcmmo.commands.mctop.repair: true + mcmmo.commands.mctop.smelting: true + mcmmo.commands.mctop.swords: true + mcmmo.commands.mctop.taming: true + mcmmo.commands.mctop.unarmed: true + mcmmo.commands.mctop.woodcutting: true mcmmo.commands.mctop: description: Allows access to the mctop command + mcmmo.commands.mctop.acrobatics: + description: Allows access to the mctop command for acrobatics + mcmmo.commands.mctop.archery: + description: Allows access to the mctop command for archery + mcmmo.commands.mctop.axes: + description: Allows access to the mctop command for axes + mcmmo.commands.mctop.excavation: + description: Allows access to the mctop command for excavation + mcmmo.commands.mctop.fishing: + description: Allows access to the mctop command for fishing + mcmmo.commands.mctop.herbalism: + description: Allows access to the mctop command for herbalism + mcmmo.commands.mctop.mining: + description: Allows access to the mctop command for mining + mcmmo.commands.mctop.repair: + description: Allows access to the mctop command for repair + mcmmo.commands.mctop.smelting: + description: Allows access to the mctop command for smelting + mcmmo.commands.mctop.swords: + description: Allows access to the mctop command for swords + mcmmo.commands.mctop.taming: + description: Allows access to the mctop command for taming + mcmmo.commands.mctop.unarmed: + description: Allows access to the mctop command for unarmed + mcmmo.commands.mctop.woodcutting: + description: Allows access to the mctop command for woodcutting mcmmo.commands.mmoedit: description: Allows access to the mmoedit command mcmmo.commands.mmoedit.others: @@ -955,8 +1002,6 @@ permissions: description: Allows access to the skillreset command for unarmed for other players mcmmo.commands.skillreset.others.woodcutting: description: Allows access to the skillreset command for woodcutting for other players - mcmmo.commands.skillreset.mining: - description: Allows access to the skillreset command for mining mcmmo.commands.skillreset.repair: description: Allows access to the skillreset command for repair mcmmo.commands.skillreset.smelting: