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;
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"));