Search in sources :

Example 1 with MagicAPI

use of com.elmakers.mine.bukkit.api.magic.MagicAPI in project MagicPlugin by elBukkit.

the class DropItemAction method getParameterOptions.

@Override
public void getParameterOptions(Spell spell, String parameterKey, Collection<String> examples) {
    if (parameterKey.equals("item")) {
        MagicAPI api = MagicPlugin.getAPI();
        examples.addAll(api.getController().getItemKeys());
    } else {
        super.getParameterOptions(spell, parameterKey, examples);
    }
}
Also used : MagicAPI(com.elmakers.mine.bukkit.api.magic.MagicAPI)

Example 2 with MagicAPI

use of com.elmakers.mine.bukkit.api.magic.MagicAPI in project MagicPlugin by elBukkit.

the class GiveItemAction method getParameterOptions.

@Override
public void getParameterOptions(Spell spell, String parameterKey, Collection<String> examples) {
    if (parameterKey.equals("item") || parameterKey.equals("require")) {
        MagicAPI api = MagicPlugin.getAPI();
        Collection<SpellTemplate> spellList = api.getSpellTemplates();
        for (SpellTemplate spellTemplate : spellList) {
            examples.add(spellTemplate.getKey());
        }
        Collection<String> allWands = api.getWandKeys();
        for (String wandKey : allWands) {
            examples.add(wandKey);
        }
        examples.addAll(api.getBrushes());
    } else {
        super.getParameterOptions(spell, parameterKey, examples);
    }
}
Also used : MagicAPI(com.elmakers.mine.bukkit.api.magic.MagicAPI) SpellTemplate(com.elmakers.mine.bukkit.api.spell.SpellTemplate)

Example 3 with MagicAPI

use of com.elmakers.mine.bukkit.api.magic.MagicAPI in project MagicPlugin by elBukkit.

the class HeroesSpellSkill method getSkillName.

/**
 * This code is redudant, but unfortunately it needs to be since we need to know the
 * skill name for the super() constructor call.
 */
private static String getSkillName(Heroes heroes, String spellKey) {
    Plugin magicPlugin = heroes.getServer().getPluginManager().getPlugin("Magic");
    if (magicPlugin == null || (!(magicPlugin instanceof MagicAPI) && !magicPlugin.isEnabled())) {
        heroes.getLogger().warning("MagicHeroes skills require the Magic plugin");
        throw new RuntimeException("MagicHeroes skills require the Magic plugin");
    }
    MagicAPI api = (MagicAPI) magicPlugin;
    MageController controller = api.getController();
    SpellTemplate spellTemplate = controller.getSpellTemplate(spellKey);
    if (spellTemplate == null) {
        controller.getLogger().warning("Failed to load Magic skill spell: " + spellKey);
        throw new RuntimeException("Failed to load Magic skill spell: " + spellKey);
    }
    String baseName = ChatColor.stripColor(spellTemplate.getName().replace(" ", ""));
    return controller.getHeroesSkillPrefix() + baseName;
}
Also used : MageController(com.elmakers.mine.bukkit.api.magic.MageController) MagicAPI(com.elmakers.mine.bukkit.api.magic.MagicAPI) Plugin(org.bukkit.plugin.Plugin) SpellTemplate(com.elmakers.mine.bukkit.api.spell.SpellTemplate)

Aggregations

MagicAPI (com.elmakers.mine.bukkit.api.magic.MagicAPI)3 SpellTemplate (com.elmakers.mine.bukkit.api.spell.SpellTemplate)2 MageController (com.elmakers.mine.bukkit.api.magic.MageController)1 Plugin (org.bukkit.plugin.Plugin)1