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);
}
}
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);
}
}
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;
}
Aggregations