Add null check to player display for console util

This commit is contained in:
Vortrex
2021-01-23 13:33:29 -06:00
parent 1b3c53f9cb
commit 1b036db6e7

View File

@@ -1801,6 +1801,9 @@ function arrayBufferToString(arrayBuffer) {
// -------------------------------------------------------------------------
function getPlayerDisplayForConsole(client) {
if(isNull(client)) {
return "(Unknown client)";
}
return `${client.name}[${client.index}]`;
}
@@ -1945,3 +1948,21 @@ function applyOffsetToVector3(position, position2) {
}
// -------------------------------------------------------------------------
function getPluralForm(name) {
return name;
}
// -------------------------------------------------------------------------
function removeColoursFromString(str) {
let matchRegex = /#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})\b/gi;
let matchedHexes = str.match(matchRegex);
for(let i in matchHex) {
str.replace(matchedHexes, `{${i}}`);
}
return [str, matchedHexes];
}
// -------------------------------------------------------------------------