Convert between spigot colorcodes and my own...

This commit is contained in:
libraryaddict 2022-01-30 11:55:52 +13:00
parent 7dffc92365
commit 88d9b081fa
4 changed files with 19 additions and 4 deletions

View File

@ -144,6 +144,10 @@ public abstract class Disguise {
name = new String[0]; name = new String[0];
} }
for (int i = 0; i < name.length; i++) {
name[i] = DisguiseUtilities.getHexedColors(name[i]);
}
name = DisguiseUtilities.reverse(name); name = DisguiseUtilities.reverse(name);
String[] oldName = multiName; String[] oldName = multiName;

View File

@ -539,6 +539,8 @@ public class FlagWatcher {
name = name.substring(1); name = name.substring(1);
} }
name = DisguiseUtilities.getHexedColors(name);
String customName = getCustomName(); String customName = getCustomName();
if (Objects.equals(customName, name)) { if (Objects.equals(customName, name)) {

View File

@ -147,10 +147,9 @@ public class PlayerDisguise extends TargetedDisguise {
*/ */
public String getProfileName() { public String getProfileName() {
return isUpsideDown() ? "Dinnerbone" : return isUpsideDown() ? "Dinnerbone" :
isDeadmau5Ears() ? "deadmau5" : hasScoreboardName() ? getScoreboardName().getPlayer() : getName().isEmpty() ? "§r" : getName(); isDeadmau5Ears() ? "deadmau5" : hasScoreboardName() ? getScoreboardName().getPlayer() : getName().isEmpty() ? "§r" : getName();
} }
public boolean isNameVisible() { public boolean isNameVisible() {
return nameVisible; return nameVisible;
} }
@ -291,10 +290,12 @@ public class PlayerDisguise extends TargetedDisguise {
} }
if (DisguiseConfig.isCopyPlayerTeamInfo() && (DisguiseConfig.getPlayerNameType() == DisguiseConfig.PlayerNameType.TEAMS || if (DisguiseConfig.isCopyPlayerTeamInfo() && (DisguiseConfig.getPlayerNameType() == DisguiseConfig.PlayerNameType.TEAMS ||
DisguiseConfig.getPlayerNameType() == DisguiseConfig.PlayerNameType.ARMORSTANDS)) { DisguiseConfig.getPlayerNameType() == DisguiseConfig.PlayerNameType.ARMORSTANDS)) {
name = DisguiseUtilities.getDisplayName(name); name = DisguiseUtilities.getDisplayName(name);
} }
name = DisguiseUtilities.getHexedColors(name);
if (name.equals(playerName)) { if (name.equals(playerName)) {
return; return;
} }

View File

@ -289,7 +289,15 @@ public class DisguiseUtilities {
name = team.getPrefix() + team.getColor() + player.getName() + team.getSuffix(); name = team.getPrefix() + team.getColor() + player.getName() + team.getSuffix();
} }
return name.replaceAll("§x§([0-9a-fA-F])§([0-9a-fA-F])§([0-9a-fA-F])§([0-9a-fA-F])§([0-9a-fA-F])§([0-9a-fA-F])", "<#$1$2$3$4$5$6>"); return getHexedColors(name);
}
public static String getHexedColors(String string) {
if (string == null) {
return string;
}
return string.replaceAll("§x§([0-9a-fA-F])§([0-9a-fA-F])§([0-9a-fA-F])§([0-9a-fA-F])§([0-9a-fA-F])§([0-9a-fA-F])", "<#$1$2$3$4$5$6>");
} }
public static String getDisplayName(String playerName) { public static String getDisplayName(String playerName) {