9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-26 02:19:25 +00:00

Fixed hex colors not working in some places

This commit is contained in:
HeroBrineGoat
2021-11-12 14:30:46 -05:00
parent 8220473836
commit 07de0c4068
5 changed files with 20 additions and 10 deletions

View File

@@ -23,8 +23,8 @@ dependencies {
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
compileOnly 'io.papermc.paper:paper:1.17.1-R0.1-SNAPSHOT'
compileOnly 'org.jetbrains:annotations:22.0.0'
compileOnly 'net.kyori:adventure-api:4.9.3'
compileOnly 'com.comphenix.protocol:ProtocolLib:4.7.0'
compileOnly 'net.kyori:adventure-api:4.9.3'
implementation 'net.kyori:adventure-text-minimessage:4.2.0-SNAPSHOT'
implementation 'net.kyori:adventure-platform-bukkit:4.0.0'
implementation 'dev.triumphteam:triumph-gui:3.0.3'

View File

@@ -4,6 +4,7 @@ import dev.triumphteam.gui.guis.GuiItem;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
import io.github.fisher2911.hmccosmetics.gui.ColorItem;
import io.github.fisher2911.hmccosmetics.gui.DyeSelectorGui;
import io.github.fisher2911.hmccosmetics.message.Adventure;
import org.bukkit.Color;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.configurate.ConfigurationNode;
@@ -82,7 +83,8 @@ public class DyeGuiSerializer implements TypeSerializer<DyeSelectorGui> {
return new DyeSelectorGui(
plugin,
titleNode.getString(),
Adventure.SERIALIZER.serialize(
Adventure.MINI_MESSAGE.parse(titleNode.getString())),
rowsNode.getInt(),
guiItemMap);
}

View File

@@ -3,6 +3,7 @@ package io.github.fisher2911.hmccosmetics.config;
import dev.triumphteam.gui.guis.GuiItem;
import io.github.fisher2911.hmccosmetics.HMCCosmetics;
import io.github.fisher2911.hmccosmetics.gui.CosmeticGui;
import io.github.fisher2911.hmccosmetics.message.Adventure;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.configurate.ConfigurationNode;
import org.spongepowered.configurate.serialize.SerializationException;
@@ -59,7 +60,11 @@ public class GuiSerializer implements TypeSerializer<CosmeticGui> {
guiItemMap.put(slot, guiItem);
}
return new CosmeticGui(plugin, titleNode.getString(), rowsNode.getInt(), guiItemMap);
return new CosmeticGui(plugin,
Adventure.SERIALIZER.serialize(
Adventure.MINI_MESSAGE.parse(titleNode.getString())),
rowsNode.getInt(),
guiItemMap);
}
@Override

View File

@@ -99,17 +99,22 @@ public class ItemSerializer implements TypeSerializer<GuiItem> {
final Material material = Utils.stringToEnum(Utils.replaceIfNull(materialNode.getString(), ""),
Material.class, Material.AIR);
final int amount = amountNode.getInt();
final Component name = Adventure.MINI_MESSAGE.parse(
Utils.replaceIfNull(nameNode.getString(), "")
);
final Component name = StringUtils.parse(nameNode.getString());
// Adventure.MINI_MESSAGE.parse(
// Utils.replaceIfNull(nameNode.getString(), "")
// );
final boolean unbreakable = unbreakableNode.getBoolean();
final boolean glowing = glowingNode.getBoolean();
final List<String> lore = Utils.replaceIfNull(loreNode.getList(String.class), new ArrayList<String>()).
stream().map(StringUtils::parseStringToString).collect(Collectors.toList());
final List<String> lockedLore = Utils.replaceIfNull(lockedLoreNode.getList(String.class), new ArrayList<String>()).
stream().map(StringUtils::parseStringToString).collect(Collectors.toList());
final int modelData = modelDataNode.getInt();
final Set<ItemFlag> itemFlags = Utils.replaceIfNull(itemFlagsNode.getList(String.class), new ArrayList<String>()).
stream().map(flag -> {
try {
@@ -121,7 +126,6 @@ public class ItemSerializer implements TypeSerializer<GuiItem> {
final String texture = textureNode.getString();
final String owner = ownerNode.getString();
final boolean dyeable = dyeableNode.getBoolean();
final Color color;

View File

@@ -98,11 +98,10 @@ public class ItemBuilder {
if (this.itemMeta == null) {
return this;
}
final String name = StringUtils.
applyPlaceholders(this.itemMeta.getDisplayName(), placeholders);
this.itemMeta.displayName(
Adventure.MINI_MESSAGE.parse(
name));
this.itemMeta.setDisplayName(name);
return this;
}