Adding a new permissions for the /mcability command.

This commit is contained in:
Glitchfinder 2013-01-30 16:29:58 -08:00
parent 01c8b8ad4a
commit c34d269f33
2 changed files with 27 additions and 3 deletions

View File

@ -1,10 +1,12 @@
package com.gmail.nossr50.commands.mc; package com.gmail.nossr50.commands.mc;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
@ -17,11 +19,25 @@ public class McabilityCommand implements CommandExecutor {
return true; 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; 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) { if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist")); sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));

View File

@ -347,6 +347,7 @@ permissions:
mcmmo.tools.mcrefresh: mcmmo.tools.mcrefresh:
description: Allows access to mcrefresh command description: Allows access to mcrefresh command
mcmmo.tools.mmoedit: mcmmo.tools.mmoedit:
default: false
description: Allows access to mmoedit command description: Allows access to mmoedit command
mcmmo.tools.mcgod: mcmmo.tools.mcgod:
description: Allows access to mcgod command description: Allows access to mcgod command
@ -710,6 +711,7 @@ permissions:
mcmmo.commands.defaults: true mcmmo.commands.defaults: true
mcmmo.commands.inspect.far: true mcmmo.commands.inspect.far: true
mcmmo.commands.inspect.offline: true mcmmo.commands.inspect.offline: true
mcmmo.commands.mcability.others: 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
@ -718,12 +720,13 @@ permissions:
mcmmo.commands.defaults: mcmmo.commands.defaults:
description: Implies all default mcmmo.commands permissions. description: Implies all default mcmmo.commands permissions.
children: children:
mcmmo.commands.ability: true
mcmmo.commands.inspect: true mcmmo.commands.inspect: true
mcmmo.commands.mcability: true
mcmmo.commands.mcstats: true mcmmo.commands.mcstats: true
mcmmo.commands.party.all: true mcmmo.commands.party.all: true
mcmmo.commands.ptp: true mcmmo.commands.ptp: true
mcmmo.commands.ability: mcmmo.commands.ability:
default: false
description: Allows access to the mcability command description: Allows access to the mcability command
mcmmo.commands.addlevels: mcmmo.commands.addlevels:
description: Allows access to the addlevels command description: Allows access to the addlevels command
@ -749,6 +752,10 @@ permissions:
description: Allows access to the inspect command for far players description: Allows access to the inspect command for far players
mcmmo.commands.inspect.offline: mcmmo.commands.inspect.offline:
description: Allows access to the inspect command for offline players 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: mcmmo.commands.mmoedit:
description: Allows access to the mmoedit command description: Allows access to the mmoedit command
mcmmo.commands.mmoedit.others: mcmmo.commands.mmoedit.others:
@ -986,4 +993,5 @@ permissions:
mcmmo.skills.smelting: mcmmo.skills.smelting:
description: Allows access to the Smelting skill description: Allows access to the Smelting skill
mcmmo.skillreset: mcmmo.skillreset:
default: false
description: Allow reset of skill levels description: Allow reset of skill levels