Added only-on-books option for descriptions

This commit is contained in:
Auxilor 2022-03-26 17:00:58 +00:00
parent 994bffb39b
commit 84e90ca338
3 changed files with 12 additions and 1 deletions

View File

@ -138,6 +138,10 @@ public class EnchantDisplay extends DisplayModule {
&& options.getDescriptionOptions().isEnabled()
&& options.getDescriptionOptions().enabledForPlayer(player)
) {
if (options.getDescriptionOptions().isOnlyOnBooks() && !(meta instanceof EnchantmentStorageMeta)) {
return;
}
lore.addAll(EnchantmentCache.getEntry(enchantment).getDescription(level));
}
}

View File

@ -34,6 +34,12 @@ public class DescriptionOptions extends PluginDependent<EcoPlugin> {
@Getter
private boolean showingAtBottom;
/**
* If descriptions should only be shown on books.
*/
@Getter
private boolean onlyOnBooks;
/**
* Create new description options.
*
@ -51,6 +57,7 @@ public class DescriptionOptions extends PluginDependent<EcoPlugin> {
enabled = this.getPlugin().getConfigYml().getBool("lore.describe.enabled");
color = this.getPlugin().getLangYml().getFormattedString("description-color");
showingAtBottom = this.getPlugin().getConfigYml().getBool("lore.describe.at-bottom");
onlyOnBooks = this.getPlugin().getConfigYml().getBool("lore.describe.only-on-books");
}
/**

View File

@ -35,7 +35,6 @@ lore:
reformat: true
numbers-only: true # If only the numbers should be reformatted
sort-by-type: false # Sort enchantments by type
sort-by-length: false # Sort enchantments by length
sort-by-rarity: false # Sort enchantments by rarity.
@ -64,6 +63,7 @@ lore:
before-lines: 5 # Describe before or equal to number of enchantments
wrap: 30 # Word wrap after number of characters
at-bottom: false # If descriptions should be shown after all enchantments rather than under each one
only-on-books: false # If descriptions should only be shown on books
# Ensure that describe and shrink have no overlap as this may cause errors