Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static error() { return new Status(TextComponent.from("Error"), TextComponent.from("Error"), -1, -1, -1); }
static from(obj: ServerStatusFrame | Status): Status {
static from(obj: ServerStatusFrame | Status): Status {
if (obj instanceof Status) {
return obj;
}
let motd: TextComponent = TextComponent.from("");
if (obj.description) {
motd = TextComponent.from(obj.description);
}
const favicon = obj.favicon;
const version = obj.version;
let versionText: TextComponent = TextComponent.from("");
let protocol = -1;
let online = -1;
let max = -1;
if (version) {
if (version.name) {
versionText = TextComponent.from(version.name);
}
if (version.protocol) {
protocol = version.protocol;
}
}
const players = obj.players;
if (players) {
online = players.online;
max = players.max;
}
static pinging() { return new Status(TextComponent.from("unknown"), TextComponent.from("Pinging..."), -1, -1, -1); }
static error() { return new Status(TextComponent.from("Error"), TextComponent.from("Error"), -1, -1, -1); }
static from(obj: ServerStatusFrame | Status): Status {
if (obj instanceof Status) {
return obj;
}
let motd: TextComponent = TextComponent.from("");
if (obj.description) {
motd = TextComponent.from(obj.description);
}
const favicon = obj.favicon;
const version = obj.version;
let versionText: TextComponent = TextComponent.from("");
let protocol = -1;
let online = -1;
let max = -1;
if (version) {
if (version.name) {
versionText = TextComponent.from(version.name);
}
if (version.protocol) {
protocol = version.protocol;
}
}
const players = obj.players;
if (obj instanceof Status) {
return obj;
}
let motd: TextComponent = TextComponent.from("");
if (obj.description) {
motd = TextComponent.from(obj.description);
}
const favicon = obj.favicon;
const version = obj.version;
let versionText: TextComponent = TextComponent.from("");
let protocol = -1;
let online = -1;
let max = -1;
if (version) {
if (version.name) {
versionText = TextComponent.from(version.name);
}
if (version.protocol) {
protocol = version.protocol;
}
}
const players = obj.players;
if (players) {
online = players.online;
max = players.max;
}
const sample = players.sample;
let profiles = new Array();
if (sample) {
profiles = new Array(sample.length);
for (let i = 0; i < sample.length; i++) {
static from(obj: ServerStatusFrame | Status): Status {
if (obj instanceof Status) {
return obj;
}
let motd: TextComponent = TextComponent.from("");
if (obj.description) {
motd = TextComponent.from(obj.description);
}
const favicon = obj.favicon;
const version = obj.version;
let versionText: TextComponent = TextComponent.from("");
let protocol = -1;
let online = -1;
let max = -1;
if (version) {
if (version.name) {
versionText = TextComponent.from(version.name);
}
if (version.protocol) {
protocol = version.protocol;
}