Search in sources :

Example 6 with Requirements

use of com.archyx.aureliumskills.requirement.Requirements in project AureliumSkills by Archy-X.

the class SkillsCommand method onItemRequirementRemove.

@Subcommand("item requirement remove")
@CommandPermission("aureliumskills.item.requirement.remove")
@CommandCompletion("@skills false|true")
@Description("Removes an item requirement from the item held, and the lore associated with it by default.")
public void onItemRequirementRemove(@Flags("itemheld") Player player, Skill skill, @Default("true") boolean lore) {
    Locale locale = plugin.getLang().getLocale(player);
    ItemStack item = player.getInventory().getItemInMainHand();
    Requirements requirements = new Requirements(plugin);
    if (requirements.hasRequirement(ModifierType.ITEM, item, skill)) {
        item = requirements.removeRequirement(ModifierType.ITEM, item, skill);
        if (lore) {
            requirements.removeLore(item, skill);
        }
        player.getInventory().setItemInMainHand(item);
        player.sendMessage(AureliumSkills.getPrefix(locale) + TextUtil.replace(Lang.getMessage(CommandMessage.ITEM_REQUIREMENT_REMOVE_REMOVED, locale), "{skill}", skill.getDisplayName(locale)));
    } else {
        player.sendMessage(AureliumSkills.getPrefix(locale) + TextUtil.replace(Lang.getMessage(CommandMessage.ITEM_REQUIREMENT_REMOVE_DOES_NOT_EXIST, locale), "{skill}", skill.getDisplayName(locale)));
    }
}
Also used : Locale(java.util.Locale) ItemStack(org.bukkit.inventory.ItemStack) Requirements(com.archyx.aureliumskills.requirement.Requirements)

Example 7 with Requirements

use of com.archyx.aureliumskills.requirement.Requirements in project AureliumSkills by Archy-X.

the class SkillsCommand method onArmorRequirementRemoveAll.

@Subcommand("armor requirement removeall")
@CommandPermission("aureliumskills.armor.requirement.removeall")
@Description("Removes all armor requirements from the item held.")
public void onArmorRequirementRemoveAll(@Flags("itemheld") Player player) {
    Locale locale = plugin.getLang().getLocale(player);
    Requirements requirements = new Requirements(plugin);
    ItemStack item = requirements.removeAllRequirements(ModifierType.ARMOR, player.getInventory().getItemInMainHand());
    player.getInventory().setItemInMainHand(item);
    player.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.ARMOR_REQUIREMENT_REMOVEALL_REMOVED, locale));
}
Also used : Locale(java.util.Locale) ItemStack(org.bukkit.inventory.ItemStack) Requirements(com.archyx.aureliumskills.requirement.Requirements)

Example 8 with Requirements

use of com.archyx.aureliumskills.requirement.Requirements in project AureliumSkills by Archy-X.

the class SkillsCommand method onArmorRequirementRemove.

@Subcommand("armor requirement remove")
@CommandPermission("aureliumskills.armor.requirement.remove")
@CommandCompletion("@skills false|true")
@Description("Removes an armor requirement from the item held, along with the lore associated it by default.")
public void onArmorRequirementRemove(@Flags("itemheld") Player player, Skill skill, @Default("true") boolean lore) {
    Locale locale = plugin.getLang().getLocale(player);
    ItemStack item = player.getInventory().getItemInMainHand();
    Requirements requirements = new Requirements(plugin);
    if (requirements.hasRequirement(ModifierType.ARMOR, item, skill)) {
        item = requirements.removeRequirement(ModifierType.ARMOR, item, skill);
        if (lore) {
            requirements.removeLore(item, skill);
        }
        player.getInventory().setItemInMainHand(item);
        player.sendMessage(AureliumSkills.getPrefix(locale) + TextUtil.replace(Lang.getMessage(CommandMessage.ARMOR_REQUIREMENT_REMOVE_REMOVED, locale), "{skill}", skill.getDisplayName(locale)));
    } else {
        player.sendMessage(AureliumSkills.getPrefix(locale) + TextUtil.replace(Lang.getMessage(CommandMessage.ARMOR_REQUIREMENT_REMOVE_DOES_NOT_EXIST, locale), "{skill}", skill.getDisplayName(locale)));
    }
}
Also used : Locale(java.util.Locale) ItemStack(org.bukkit.inventory.ItemStack) Requirements(com.archyx.aureliumskills.requirement.Requirements)

Example 9 with Requirements

use of com.archyx.aureliumskills.requirement.Requirements in project AureliumSkills by Archy-X.

the class SkillsCommand method onArmorRequirementList.

@Subcommand("armor requirement list")
@CommandPermission("aureliumskills.armor.requirement.list")
@Description("Lists the armor requirements on the item held.")
public void onArmorRequirementList(@Flags("itemheld") Player player) {
    Locale locale = plugin.getLang().getLocale(player);
    player.sendMessage(Lang.getMessage(CommandMessage.ARMOR_REQUIREMENT_LIST_HEADER, locale));
    Requirements requirements = new Requirements(plugin);
    for (Map.Entry<Skill, Integer> entry : requirements.getRequirements(ModifierType.ARMOR, player.getInventory().getItemInMainHand()).entrySet()) {
        player.sendMessage(TextUtil.replace(Lang.getMessage(CommandMessage.ARMOR_REQUIREMENT_LIST_ENTRY, locale), "{skill}", entry.getKey().getDisplayName(locale), "{level}", String.valueOf(entry.getValue())));
    }
}
Also used : Locale(java.util.Locale) Skill(com.archyx.aureliumskills.skills.Skill) Map(java.util.Map) Requirements(com.archyx.aureliumskills.requirement.Requirements)

Aggregations

Requirements (com.archyx.aureliumskills.requirement.Requirements)9 Locale (java.util.Locale)8 ItemStack (org.bukkit.inventory.ItemStack)7 Skill (com.archyx.aureliumskills.skills.Skill)2 Map (java.util.Map)2 PlayerData (com.archyx.aureliumskills.data.PlayerData)1 Stat (com.archyx.aureliumskills.stats.Stat)1 HashSet (java.util.HashSet)1 EntityEquipment (org.bukkit.inventory.EntityEquipment)1