From c34d269f33bd3a97b1a27ff1efe4e60c035468fc Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Wed, 30 Jan 2013 16:29:58 -0800 Subject: [PATCH] Adding a new permissions for the /mcability command. --- .../nossr50/commands/mc/McabilityCommand.java | 20 +++++++++++++++++-- src/main/resources/plugin.yml | 10 +++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/mc/McabilityCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/McabilityCommand.java index 51d6480c0..5f02aa862 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McabilityCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McabilityCommand.java @@ -1,10 +1,12 @@ package com.gmail.nossr50.commands.mc; +import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.locale.LocaleLoader; @@ -17,11 +19,25 @@ public class McabilityCommand implements CommandExecutor { return true; } - if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.ability")) { + // DEPRECATED PERMISSION + boolean oldPermission = !CommandHelper.noCommandPermissions(sender, "mcmmo.commands.ability"); + + if (!oldPermission && CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mcability")) { return true; } - PlayerProfile profile = Users.getProfile((Player) sender); + PlayerProfile profile = null; + + if(args.length > 0 && args[0] != null) { + if (!oldPermission && CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mcability.others")) { + return true; + } + + OfflinePlayer modifiedPlayer = mcMMO.p.getServer().getOfflinePlayer(args[0]); + profile = Users.getProfile(modifiedPlayer); + } + else + profile = Users.getProfile((Player) sender); if (profile == null) { sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist")); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 04d9044c3..d4f0db671 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -347,6 +347,7 @@ permissions: mcmmo.tools.mcrefresh: description: Allows access to mcrefresh command mcmmo.tools.mmoedit: + default: false description: Allows access to mmoedit command mcmmo.tools.mcgod: description: Allows access to mcgod command @@ -710,6 +711,7 @@ permissions: mcmmo.commands.defaults: true mcmmo.commands.inspect.far: true mcmmo.commands.inspect.offline: true + mcmmo.commands.mcability.others: true mcmmo.commands.mmoedit: true mcmmo.commands.mmoedit.others: true mcmmo.commands.mmoupdate: true @@ -718,12 +720,13 @@ permissions: mcmmo.commands.defaults: description: Implies all default mcmmo.commands permissions. children: - mcmmo.commands.ability: true mcmmo.commands.inspect: true + mcmmo.commands.mcability: true mcmmo.commands.mcstats: true mcmmo.commands.party.all: true mcmmo.commands.ptp: true mcmmo.commands.ability: + default: false description: Allows access to the mcability command mcmmo.commands.addlevels: description: Allows access to the addlevels command @@ -749,6 +752,10 @@ permissions: description: Allows access to the inspect command for far players mcmmo.commands.inspect.offline: description: Allows access to the inspect command for offline players + mcmmo.commands.mcability: + description: Allows access to the mcability command + mcmmo.commands.mcability.others: + description: Allows access to the mcability command for other players mcmmo.commands.mmoedit: description: Allows access to the mmoedit command mcmmo.commands.mmoedit.others: @@ -986,4 +993,5 @@ permissions: mcmmo.skills.smelting: description: Allows access to the Smelting skill mcmmo.skillreset: + default: false description: Allow reset of skill levels \ No newline at end of file