Skip to content

Commit

Permalink
Strip colors
Browse files Browse the repository at this point in the history
  • Loading branch information
fromgate committed Dec 28, 2016
1 parent 4a0b7b9 commit 069a1f6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/main/java/ru/nukkit/multichat/util/Cfg.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class Cfg extends SimpleConfig {
@Path("name-tag.format")
public String nametagFormat = "&a%prefix%&6%player%";

@Path("name-tag.strip-colors")
public boolean nametagStripColor = false;

@Path("display-name.enable")
public boolean displayNameEnable = true;

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/ru/nukkit/multichat/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public static String getCustomFormat(Player player) {
}

public static String getCustomNameTag(Player player) {
return getCusomParam(player, false);
String nameTag = getCusomParam(player, false);
return MultiChat.getCfg().nametagStripColor ? TextFormat.clean(nameTag) : nameTag;
}

private static String getCusomParam(Player player, boolean getFormat) {
Expand All @@ -41,7 +42,7 @@ private static String getCustomDisplayName(Player player) {
result = section.getString(key + param);
}
}
return result;
return MultiChat.getCfg().isDisplayNameNoColors ? TextFormat.clean(result) : result;
}

private static boolean isPlayerInGroup(Player player, String group) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ name-tag:
# Default name-tag format
enable: true
format: '&a%prefix%&6%player%'
# Remove color codes from name tags
strip-colors: false
display-name:
# Enable display name (shown by TAB-key)
enable: true
Expand Down

0 comments on commit 069a1f6

Please sign in to comment.