From 40be52f5555bd8ea24cac93e5bacaafb7b87908e Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Fri, 8 Nov 2024 20:01:48 +1100 Subject: [PATCH] fix styled output --- .../folk/sisby/switchy/modules/StyledNicknamesModule.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compat/src/main/java/folk/sisby/switchy/modules/StyledNicknamesModule.java b/compat/src/main/java/folk/sisby/switchy/modules/StyledNicknamesModule.java index 3aa301e..81bc9c9 100644 --- a/compat/src/main/java/folk/sisby/switchy/modules/StyledNicknamesModule.java +++ b/compat/src/main/java/folk/sisby/switchy/modules/StyledNicknamesModule.java @@ -1,8 +1,9 @@ package folk.sisby.switchy.modules; -import eu.pb4.placeholders.api.Placeholders; +import eu.pb4.placeholders.api.ParserContext; import eu.pb4.placeholders.api.TextParserUtils; import eu.pb4.stylednicknames.NicknameHolder; +import eu.pb4.stylednicknames.config.Config; import eu.pb4.stylednicknames.config.ConfigManager; import folk.sisby.switchy.SwitchyCompat; import folk.sisby.switchy.api.module.SwitchyModule; @@ -19,7 +20,6 @@ import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; -import java.util.Map; import java.util.Objects; import static folk.sisby.switchy.util.Feedback.translatable; @@ -112,6 +112,6 @@ public Text getText() { */ public Text getOutput() { Text nickname = getText(); - return styled_nickname != null ? Placeholders.parseText(ConfigManager.getConfig().nicknameFormat, Placeholders.PREDEFINED_PLACEHOLDER_PATTERN, Map.of("nickname", nickname, "name", nickname)) : null; + return styled_nickname != null ? ConfigManager.getConfig().nicknameFormat.toText(ParserContext.of(Config.KEY, s -> nickname)).copy() : null; } }