Add null check to player display for console util
This commit is contained in:
@@ -1801,6 +1801,9 @@ function arrayBufferToString(arrayBuffer) {
|
|||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
function getPlayerDisplayForConsole(client) {
|
function getPlayerDisplayForConsole(client) {
|
||||||
|
if(isNull(client)) {
|
||||||
|
return "(Unknown client)";
|
||||||
|
}
|
||||||
return `${client.name}[${client.index}]`;
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
Reference in New Issue
Block a user