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 250158fd..50aa591a 100644 --- a/compat/src/main/java/folk/sisby/switchy/modules/StyledNicknamesModule.java +++ b/compat/src/main/java/folk/sisby/switchy/modules/StyledNicknamesModule.java @@ -1,7 +1,9 @@ package folk.sisby.switchy.modules; +import eu.pb4.placeholders.api.Placeholders; import eu.pb4.placeholders.api.TextParserUtils; import eu.pb4.stylednicknames.NicknameHolder; +import eu.pb4.stylednicknames.config.ConfigManager; import folk.sisby.switchy.SwitchyCompat; import folk.sisby.switchy.api.module.*; import net.minecraft.nbt.NbtCompound; @@ -10,6 +12,7 @@ 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; @@ -95,4 +98,12 @@ public void fillFromNbt(NbtCompound nbt) { public Text getText() { return styled_nickname != null ? TextParserUtils.formatText(styled_nickname) : null; } + + /** + * @return the formatted nickname as would be shown in chat. + */ + 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; + } } diff --git a/gradle.properties b/gradle.properties index f22c7914..33e8197e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,6 +2,6 @@ org.gradle.jvmargs=-Xmx4G org.gradle.parallel=true # Mod Properties -version=2.8.0 +version=2.8.1 maven_group=folk.sisby archives_base_name=switchy