Added option to display enchantments below item lore

This commit is contained in:
Auxilor 2021-08-10 18:39:53 +01:00
parent 63bd87ff66
commit 1e0002484e
3 changed files with 14 additions and 1 deletions

View File

@ -158,7 +158,11 @@ public class EnchantDisplay extends DisplayModule {
}
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
lore.addAll(itemLore);
if (this.getOptions().isAboveLore()) {
lore.addAll(itemLore);
} else {
lore.addAll(0, itemLore);
}
itemStack.setItemMeta(meta);
fastItemStack.setLore(lore);
}

View File

@ -61,6 +61,12 @@ public class DisplayOptions extends PluginDependent<EcoPlugin> {
@Getter
private boolean requireTarget = true;
/**
* If enchants should be displayed above lore.
*/
@Getter
private boolean aboveLore = true;
/**
* Instantiate new display options.
*
@ -96,6 +102,7 @@ public class DisplayOptions extends PluginDependent<EcoPlugin> {
sortedRarities.addAll(EnchantmentRarity.values().stream().filter(enchantmentRarity -> !sortedRarities.contains(enchantmentRarity)).collect(Collectors.toList()));
requireTarget = this.getPlugin().getConfigYml().getBool("lore.require-target");
aboveLore = this.getPlugin().getConfigYml().getBool("lore.above-other-lore");
boolean byType = this.getPlugin().getConfigYml().getBool("lore.sort-by-type");
boolean byLength = this.getPlugin().getConfigYml().getBool("lore.sort-by-length");

View File

@ -27,6 +27,8 @@ lore:
use-numerals: true
use-numbers-above-threshold: 10 # After level 10, enchantments will display as Name Number, eg: Sharpness 25 instead of Sharpness XXV
above-other-lore: true # If enchantments should be displayed above other lore
# If above max level enchantments should be formatted differently
# Format is available in lang.yml
above-max-level: