Skip to content

Commit

Permalink
add getOutput to SN module
Browse files Browse the repository at this point in the history
  • Loading branch information
sisby-folk committed Sep 9, 2023
1 parent b5c2dbc commit 95499d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 95499d8

Please sign in to comment.