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

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

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

@ -150,7 +150,6 @@ public class PlayerDisguise extends TargetedDisguise {
isDeadmau5Ears() ? "deadmau5" : hasScoreboardName() ? getScoreboardName().getPlayer() : getName().isEmpty() ? "§r" : getName();
}
public boolean isNameVisible() {
return nameVisible;
}
@ -295,6 +294,8 @@ public class PlayerDisguise extends TargetedDisguise {
name = DisguiseUtilities.getDisplayName(name);
}
name = DisguiseUtilities.getHexedColors(name);
if (name.equals(playerName)) {
return;
}

@ -289,7 +289,15 @@ public class DisguiseUtilities {
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) {