Search in sources :

Example 1 with SkillSelectorAction

use of com.elmakers.mine.bukkit.action.builtin.SkillSelectorAction in project MagicPlugin by elBukkit.

the class MagicSkillsCommandExecutor method onCommand.

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (!api.hasPermission(sender, "Magic.commands.mskills")) {
        sendNoPermission(sender);
        return true;
    }
    if (!(sender instanceof Player)) {
        sender.sendMessage(ChatColor.RED + "This command may only be used in-game");
        return true;
    }
    Mage mage = controller.getMage(sender);
    SkillSelectorAction selector = new SkillSelectorAction();
    int page = 1;
    if (args.length > 0) {
        try {
            page = Integer.parseInt(args[0]);
        } catch (Exception ex) {
            sender.sendMessage(ChatColor.RED + "Expect page number, got " + args[0]);
            return true;
        }
    }
    selector.setPage(page);
    selector.perform(new CastContext(mage));
    return true;
}
Also used : Player(org.bukkit.entity.Player) CastContext(com.elmakers.mine.bukkit.action.CastContext) Mage(com.elmakers.mine.bukkit.api.magic.Mage) SkillSelectorAction(com.elmakers.mine.bukkit.action.builtin.SkillSelectorAction)

Aggregations

CastContext (com.elmakers.mine.bukkit.action.CastContext)1 SkillSelectorAction (com.elmakers.mine.bukkit.action.builtin.SkillSelectorAction)1 Mage (com.elmakers.mine.bukkit.api.magic.Mage)1 Player (org.bukkit.entity.Player)1