mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2025-01-29 22:51:21 +01:00
Added support for displaying lore in item tooltips (#420)
This commit is contained in:
parent
8459181f77
commit
d7910262be
@ -7,7 +7,6 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
@ -28,6 +27,7 @@ import org.bukkit.inventory.meta.SuspiciousStewMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import net.coreprotect.bukkit.BukkitAdapter;
|
||||
import net.coreprotect.utility.Color;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public class ItemMetaHandler {
|
||||
@ -96,7 +96,8 @@ public class ItemMetaHandler {
|
||||
|
||||
public static List<String> getEnchantments(ItemStack item, String displayName) {
|
||||
List<String> result = new ArrayList<>();
|
||||
Map<Enchantment, Integer> enchantments = getEnchantments(item.getItemMeta());
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
Map<Enchantment, Integer> enchantments = getEnchantments(itemMeta);
|
||||
|
||||
for (Entry<Enchantment, Integer> entry : enchantments.entrySet()) {
|
||||
Enchantment enchantment = entry.getKey();
|
||||
@ -105,6 +106,12 @@ public class ItemMetaHandler {
|
||||
result.add(getEnchantmentName(enchantment, level));
|
||||
}
|
||||
|
||||
if (itemMeta.hasLore()) {
|
||||
for (String lore : itemMeta.getLore()) {
|
||||
result.add(Color.DARK_PURPLE + Color.ITALIC + lore);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -284,11 +291,11 @@ public class ItemMetaHandler {
|
||||
List<Map<String, Object>> fadeList = new ArrayList<>();
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
|
||||
for (Color color : effect.getColors()) {
|
||||
for (org.bukkit.Color color : effect.getColors()) {
|
||||
colorList.add(color.serialize());
|
||||
}
|
||||
|
||||
for (Color color : effect.getFadeColors()) {
|
||||
for (org.bukkit.Color color : effect.getFadeColors()) {
|
||||
fadeList.add(color.serialize());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user