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