PR Changes

This commit is contained in:
Auxilor 2022-01-21 15:30:27 +00:00
parent 9f143ea5ea
commit 737c181034
3 changed files with 18 additions and 8 deletions

View File

@ -12,7 +12,6 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
import com.willfp.ecoenchants.enchantments.util.ItemConversionOptions;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
@ -178,7 +177,7 @@ public class EnchantDisplay extends DisplayModule {
}
}
if (itemStack.getType() != Material.ENCHANTED_BOOK) {
if (!(meta instanceof EnchantmentStorageMeta && !options.isPrefixOnBooks())) {
if (!enchantments.isEmpty()) {
lore.addAll(0, options.getLorePrefix());
lore.addAll(options.getLoreSuffix());

View File

@ -3,7 +3,6 @@ package com.willfp.ecoenchants.display.options;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent;
import com.willfp.eco.core.display.Display;
import com.willfp.eco.util.StringUtils;
import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
import com.willfp.ecoenchants.display.options.sorting.SortParameters;
import com.willfp.ecoenchants.display.options.sorting.SorterManager;
@ -13,7 +12,11 @@ import lombok.Getter;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
public class DisplayOptions extends PluginDependent<EcoPlugin> {
@ -71,16 +74,23 @@ public class DisplayOptions extends PluginDependent<EcoPlugin> {
private boolean aboveLore = true;
/**
* Lore prefix (above enchantments)
* Lore prefix (above enchantments).
*/
@Getter
private List<String> lorePrefix;
/**
* Lore suffix (below enchantments)
* Lore suffix (below enchantments).
*/
@Getter
private List<String> loreSuffix;
/**
* If prefix/suffix should show on books.
*/
@Getter
private boolean prefixOnBooks;
/**
* Instantiate new display options.
*
@ -121,6 +131,7 @@ public class DisplayOptions extends PluginDependent<EcoPlugin> {
lorePrefix = this.getPlugin().getConfigYml().getFormattedStrings("lore.prefix").stream().map(s -> Display.PREFIX + s).collect(Collectors.toList());
loreSuffix = this.getPlugin().getConfigYml().getFormattedStrings("lore.suffix").stream().map(s -> Display.PREFIX + s).collect(Collectors.toList());
prefixOnBooks = this.getPlugin().getConfigYml().getBool("lore.prefix-on-books");
boolean byType = this.getPlugin().getConfigYml().getBool("lore.sort-by-type");
boolean byLength = this.getPlugin().getConfigYml().getBool("lore.sort-by-length");

View File

@ -72,9 +72,9 @@ lore:
after-lines: 9 # Collapse after number of enchantments
maximum-per-line: 2 # Maximum number of enchantments to have in 1 line
prefix: # Lines used above the enchantments
- ""
prefix: [] # Lines used above the enchantments
suffix: [] # Lines used below the enchantments
prefix-on-books: false # If the prefix/suffix should work on books as well as items
enchanting-table:
enabled: true # Enable EcoEnchants through an enchanting table