Search in sources :

Example 1 with Skills

use of com.archyx.aureliumskills.skills.Skills in project AureliumSkills by Archy-X.

the class SkillsMenu method init.

public void init(Player player, InventoryContents contents) {
    // Fill item
    if (options.isFillEnabled()) {
        contents.fill(ClickableItem.empty(options.getFillItem()));
    }
    // Close item
    CloseItem closeItem = (CloseItem) options.getItem(ItemType.CLOSE);
    contents.set(closeItem.getPos(), ClickableItem.of(closeItem.getItem(player, locale), e -> player.closeInventory()));
    // Your skills item
    YourSkillsItem yourSkillsItem = (YourSkillsItem) options.getItem(ItemType.YOUR_SKILLS);
    contents.set(yourSkillsItem.getPos(), ClickableItem.empty(yourSkillsItem.getItem(player, locale)));
    // Skill items
    SkillTemplate skillTemplate = (SkillTemplate) options.getTemplate(TemplateType.SKILL);
    if (OptionL.isEnabled(Skills.FARMING)) {
        contents.set(skillTemplate.getPosition(Skills.FARMING), ClickableItem.of(skillTemplate.getItem(Skills.FARMING, playerData, player, locale), e -> open(player, playerData, Skills.FARMING)));
    }
    if (OptionL.isEnabled(Skills.FORAGING)) {
        contents.set(skillTemplate.getPosition(Skills.FORAGING), ClickableItem.of(skillTemplate.getItem(Skills.FORAGING, playerData, player, locale), e -> open(player, playerData, Skills.FORAGING)));
    }
    if (OptionL.isEnabled(Skills.MINING)) {
        contents.set(skillTemplate.getPosition(Skills.MINING), ClickableItem.of(skillTemplate.getItem(Skills.MINING, playerData, player, locale), e -> open(player, playerData, Skills.MINING)));
    }
    if (OptionL.isEnabled(Skills.FISHING)) {
        contents.set(skillTemplate.getPosition(Skills.FISHING), ClickableItem.of(skillTemplate.getItem(Skills.FISHING, playerData, player, locale), e -> open(player, playerData, Skills.FISHING)));
    }
    if (OptionL.isEnabled(Skills.EXCAVATION)) {
        contents.set(skillTemplate.getPosition(Skills.EXCAVATION), ClickableItem.of(skillTemplate.getItem(Skills.EXCAVATION, playerData, player, locale), e -> open(player, playerData, Skills.EXCAVATION)));
    }
    // Combat Skills
    if (OptionL.isEnabled(Skills.ARCHERY)) {
        contents.set(skillTemplate.getPosition(Skills.ARCHERY), ClickableItem.of(skillTemplate.getItem(Skills.ARCHERY, playerData, player, locale), e -> open(player, playerData, Skills.ARCHERY)));
    }
    if (OptionL.isEnabled(Skills.DEFENSE)) {
        contents.set(skillTemplate.getPosition(Skills.DEFENSE), ClickableItem.of(skillTemplate.getItem(Skills.DEFENSE, playerData, player, locale), e -> open(player, playerData, Skills.DEFENSE)));
    }
    if (OptionL.isEnabled(Skills.FIGHTING)) {
        contents.set(skillTemplate.getPosition(Skills.FIGHTING), ClickableItem.of(skillTemplate.getItem(Skills.FIGHTING, playerData, player, locale), e -> open(player, playerData, Skills.FIGHTING)));
    }
    if (OptionL.isEnabled(Skills.ENDURANCE)) {
        contents.set(skillTemplate.getPosition(Skills.ENDURANCE), ClickableItem.of(skillTemplate.getItem(Skills.ENDURANCE, playerData, player, locale), e -> open(player, playerData, Skills.ENDURANCE)));
    }
    if (OptionL.isEnabled(Skills.AGILITY)) {
        contents.set(skillTemplate.getPosition(Skills.AGILITY), ClickableItem.of(skillTemplate.getItem(Skills.AGILITY, playerData, player, locale), e -> open(player, playerData, Skills.AGILITY)));
    }
    // Magic Skills
    if (OptionL.isEnabled(Skills.ALCHEMY)) {
        contents.set(skillTemplate.getPosition(Skills.ALCHEMY), ClickableItem.of(skillTemplate.getItem(Skills.ALCHEMY, playerData, player, locale), e -> open(player, playerData, Skills.ALCHEMY)));
    }
    if (OptionL.isEnabled(Skills.ENCHANTING)) {
        contents.set(skillTemplate.getPosition(Skills.ENCHANTING), ClickableItem.of(skillTemplate.getItem(Skills.ENCHANTING, playerData, player, locale), e -> open(player, playerData, Skills.ENCHANTING)));
    }
    if (OptionL.isEnabled(Skills.SORCERY)) {
        contents.set(skillTemplate.getPosition(Skills.SORCERY), ClickableItem.of(skillTemplate.getItem(Skills.SORCERY, playerData, player, locale), e -> open(player, playerData, Skills.SORCERY)));
    }
    if (OptionL.isEnabled(Skills.HEALING)) {
        contents.set(skillTemplate.getPosition(Skills.HEALING), ClickableItem.of(skillTemplate.getItem(Skills.HEALING, playerData, player, locale), e -> open(player, playerData, Skills.HEALING)));
    }
    if (OptionL.isEnabled(Skills.FORGING)) {
        contents.set(skillTemplate.getPosition(Skills.FORGING), ClickableItem.of(skillTemplate.getItem(Skills.FORGING, playerData, player, locale), e -> open(player, playerData, Skills.FORGING)));
    }
}
Also used : CloseItem(com.archyx.aureliumskills.menu.items.CloseItem) TemplateType(com.archyx.aureliumskills.menu.templates.TemplateType) MenuMessage(com.archyx.aureliumskills.lang.MenuMessage) SmartInventory(fr.minuskube.inv.SmartInventory) OptionL(com.archyx.aureliumskills.configuration.OptionL) Player(org.bukkit.entity.Player) Nullable(org.jetbrains.annotations.Nullable) SkillTemplate(com.archyx.aureliumskills.menu.templates.SkillTemplate) AureliumSkills(com.archyx.aureliumskills.AureliumSkills) Lang(com.archyx.aureliumskills.lang.Lang) CloseItem(com.archyx.aureliumskills.menu.items.CloseItem) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) InventoryContents(fr.minuskube.inv.content.InventoryContents) Locale(java.util.Locale) PlayerData(com.archyx.aureliumskills.data.PlayerData) Skill(com.archyx.aureliumskills.skills.Skill) ItemType(com.archyx.aureliumskills.menu.items.ItemType) YourSkillsItem(com.archyx.aureliumskills.menu.items.YourSkillsItem) Skills(com.archyx.aureliumskills.skills.Skills) ClickableItem(fr.minuskube.inv.ClickableItem) SkillTemplate(com.archyx.aureliumskills.menu.templates.SkillTemplate) YourSkillsItem(com.archyx.aureliumskills.menu.items.YourSkillsItem)

Example 2 with Skills

use of com.archyx.aureliumskills.skills.Skills in project MagicPlugin by elBukkit.

the class AureliumSkillsManager method load.

public void load(ConfigurationSection configuration) {
    enabled = configuration.getBoolean("enabled", true);
    useAttributes = enabled && configuration.getBoolean("use_attributes", true);
    manaScale = configuration.getDouble("mana_scale", 1.0);
    manaCostReduction = configuration.getDouble("mana_cost_reduction", 0.0);
    registerCurrencies = enabled && configuration.getBoolean("use_xp_currencies", true);
    if (manaScale <= 0) {
        controller.getLogger().info("Invalid mana scale in aurelium_skills configuration: " + manaScale);
        manaScale = 1;
    }
    boolean useMana = enabled && configuration.getBoolean("use_mana", true);
    usesMana.clear();
    if (useMana) {
        usesMana.addAll(ConfigurationUtils.getStringList(configuration, "mana_classes"));
    } else {
        manaCostReduction = 0;
    }
    useMana = !usesMana.isEmpty();
    xpEarnRates.clear();
    ConfigurationSection earnRates = configuration.getConfigurationSection("xp_earn_from_sp");
    for (String key : earnRates.getKeys(false)) {
        try {
            Skills skill = Skills.valueOf(key);
            xpEarnRates.put(skill, earnRates.getDouble(key));
        } catch (Exception ex) {
            controller.getLogger().warning("Invalid AureliumSkills XP type in xp_earn_from_sp config: " + key);
        }
    }
    String statusString;
    if (!useMana && !useAttributes && !registerCurrencies) {
        statusString = " but integration is disabled in configs";
    } else {
        statusString = ", will integrate for ";
        List<String> integrations = new ArrayList<>();
        if (useMana) {
            integrations.add("mana for classes (" + StringUtils.join(usesMana, ",") + ")");
        }
        if (useAttributes) {
            integrations.add("skill/stat attributes");
        }
        if (registerCurrencies) {
            integrations.add("xp currencies");
        }
        statusString += StringUtils.join(integrations, ",");
    }
    controller.getLogger().info("AureliumSkills found" + statusString);
    if (!useMana) {
        controller.getLogger().info("  If you want Magic spells to use AureliumSkills mana, use &7/mconfig configure config aurelium_skills.use_mana true");
    }
}
Also used : Skills(com.archyx.aureliumskills.skills.Skills) ArrayList(java.util.ArrayList) ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Example 3 with Skills

use of com.archyx.aureliumskills.skills.Skills in project MagicPlugin by elBukkit.

the class AureliumSkillsManager method register.

public void register(ConfigurationSection currencyConfiguration) {
    if (registerCurrencies) {
        List<String> names = new ArrayList<>();
        for (Skills skill : Skills.values()) {
            ConfigurationSection configuration = currencyConfiguration.getConfigurationSection(skill.name());
            if (configuration == null) {
                configuration = ConfigurationUtils.newConfigurationSection();
            }
            controller.register(new AureliumSkillCurrency(this, skill, configuration));
            names.add(skill.name());
        }
        controller.getLogger().info("Registered AureliumSkills XP as currencies: " + StringUtils.join(names, ","));
    }
}
Also used : Skills(com.archyx.aureliumskills.skills.Skills) ArrayList(java.util.ArrayList) ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Aggregations

Skills (com.archyx.aureliumskills.skills.Skills)3 ArrayList (java.util.ArrayList)2 ConfigurationSection (org.bukkit.configuration.ConfigurationSection)2 AureliumSkills (com.archyx.aureliumskills.AureliumSkills)1 OptionL (com.archyx.aureliumskills.configuration.OptionL)1 PlayerData (com.archyx.aureliumskills.data.PlayerData)1 Lang (com.archyx.aureliumskills.lang.Lang)1 MenuMessage (com.archyx.aureliumskills.lang.MenuMessage)1 CloseItem (com.archyx.aureliumskills.menu.items.CloseItem)1 ItemType (com.archyx.aureliumskills.menu.items.ItemType)1 YourSkillsItem (com.archyx.aureliumskills.menu.items.YourSkillsItem)1 SkillTemplate (com.archyx.aureliumskills.menu.templates.SkillTemplate)1 TemplateType (com.archyx.aureliumskills.menu.templates.TemplateType)1 Skill (com.archyx.aureliumskills.skills.Skill)1 ClickableItem (fr.minuskube.inv.ClickableItem)1 SmartInventory (fr.minuskube.inv.SmartInventory)1 InventoryContents (fr.minuskube.inv.content.InventoryContents)1 InventoryProvider (fr.minuskube.inv.content.InventoryProvider)1 Locale (java.util.Locale)1 Player (org.bukkit.entity.Player)1