mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-22 04:37:42 +01:00
This build fixes ticket #0850. Hex colors now work correctly in item names and lores.
This commit is contained in:
parent
77f6e2f258
commit
cc294a79f6
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOItems</artifactId>
|
||||
<version>6.5.3</version>
|
||||
<version>6.5.4</version>
|
||||
<name>MMOItems</name>
|
||||
<description>A great item solution for your RPG server!</description>
|
||||
|
||||
|
@ -4,6 +4,8 @@ import com.google.gson.JsonArray;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.utils.text.Component;
|
||||
import io.lumine.mythic.utils.text.format.TextDecoration;
|
||||
import io.lumine.mythic.utils.text.minimessage.MiniMessage;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
@ -11,7 +13,11 @@ import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.util.DynamicLore;
|
||||
import net.Indyuce.mmoitems.api.util.StatFormat;
|
||||
import net.Indyuce.mmoitems.stat.data.*;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.Indyuce.mmoitems.stat.data.MaterialData;
|
||||
import net.Indyuce.mmoitems.stat.data.StoredTagsData;
|
||||
import net.Indyuce.mmoitems.stat.data.StringListData;
|
||||
import net.Indyuce.mmoitems.stat.data.UpgradeData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.UpgradeInfo;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
@ -24,7 +30,11 @@ import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ItemStackBuilder {
|
||||
@ -159,11 +169,14 @@ public class ItemStackBuilder {
|
||||
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, fakeModifier);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
NBTItem nbtItem = MythicLib.plugin.getVersion().getWrapper().getNBTItem(item);
|
||||
NBTItem nbtItem = NBTItem.get(item);
|
||||
|
||||
nbtItem.addTag(tags);
|
||||
|
||||
nbtItem.setDisplayNameComponent(MiniMessage.get().parse(meta.getDisplayName()));
|
||||
nbtItem.setDisplayNameComponent(Component.text()
|
||||
.append(MiniMessage.get().parse(meta.getDisplayName())
|
||||
.decoration(TextDecoration.ITALIC, false))
|
||||
.build());
|
||||
|
||||
return nbtItem;
|
||||
}
|
||||
|
@ -1,9 +1,14 @@
|
||||
package net.Indyuce.mmoitems.api.item.build;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class LoreBuilder {
|
||||
private final List<String> lore = new ArrayList<>();
|
||||
@ -43,7 +48,7 @@ public class LoreBuilder {
|
||||
str = str.replace("{" + holder + "}", placeholders.getOrDefault(holder, "PHE"));
|
||||
}
|
||||
|
||||
return MythicLib.plugin.parseColors(str);
|
||||
return ChatColor.translateAlternateColorCodes('&', str);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,7 +126,8 @@ public class LoreBuilder {
|
||||
*/
|
||||
final List<String> cleaned = new ArrayList<>();
|
||||
for (String s : lore)
|
||||
cleaned.addAll(Arrays.asList(MythicLib.plugin.parseColors(s.replace("{bar}", "").replace("{sbar}", "")).split("\\\\n")));
|
||||
cleaned.addAll(Arrays.asList(ChatColor.translateAlternateColorCodes('&',
|
||||
s.replace("{bar}", "").replace("{sbar}", "")).split("\\\\n")));
|
||||
|
||||
return cleaned;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.google.gson.JsonElement;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.utils.text.Component;
|
||||
import io.lumine.mythic.utils.text.format.TextDecoration;
|
||||
import io.lumine.mythic.utils.text.minimessage.MiniMessage;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -26,7 +27,10 @@ public class DynamicLore {
|
||||
for (JsonElement e : array) {
|
||||
String s = replace(e.getAsString());
|
||||
if(!s.equals("!INVALID!"))
|
||||
lore.add(MiniMessage.get().parse(s));
|
||||
lore.add(Component.text()
|
||||
.append(MiniMessage.get().parse(s))
|
||||
.decoration(TextDecoration.ITALIC, false)
|
||||
.build());
|
||||
}
|
||||
item.setLoreComponents(lore);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
@ -26,7 +25,7 @@ public class DisplayName extends StringStat {
|
||||
format = format.replace("<tier-name>", tier != null ? ChatColor.stripColor(tier.getName()) : "");
|
||||
format = format.replace("<tier-color>", tier != null ? ChatColor.getLastColors(tier.getName()) : "&f");
|
||||
|
||||
item.getMeta().setDisplayName(MythicLib.plugin.parseColors(format));
|
||||
item.getMeta().setDisplayName(ChatColor.translateAlternateColorCodes('&', format));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user