From 1e0002484e83bbaee8a9817abaff1d9df225cd79 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Tue, 10 Aug 2021 18:39:53 +0100 Subject: [PATCH] Added option to display enchantments below item lore --- .../com/willfp/ecoenchants/display/EnchantDisplay.java | 6 +++++- .../willfp/ecoenchants/display/options/DisplayOptions.java | 7 +++++++ eco-core/core-plugin/src/main/resources/config.yml | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java index aeca628b..f446c29a 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java @@ -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); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DisplayOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DisplayOptions.java index 5845edb6..c3e4bd9a 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DisplayOptions.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DisplayOptions.java @@ -61,6 +61,12 @@ public class DisplayOptions extends PluginDependent { @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 { 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"); diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index 2d5a817a..82b2b3c2 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -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: