mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-01 03:53:47 +01:00
more ip conversion
This commit is contained in:
parent
a7dfb1a537
commit
2958034ad4
@ -89,15 +89,15 @@ export function createUniqueRandomIp(): string {
|
|||||||
|
|
||||||
// Saftely add a Server to the AllServers map
|
// Saftely add a Server to the AllServers map
|
||||||
export function AddToAllServers(server: Server | HacknetServer): void {
|
export function AddToAllServers(server: Server | HacknetServer): void {
|
||||||
const serverIp = server.ip;
|
if (GetServer(server.hostname)) {
|
||||||
if (ipExists(serverIp)) {
|
console.warn(`IP of server that's being added: ${server.ip}`);
|
||||||
console.warn(`IP of server that's being added: ${serverIp}`);
|
|
||||||
console.warn(`Hostname of the server thats being added: ${server.hostname}`);
|
console.warn(`Hostname of the server thats being added: ${server.hostname}`);
|
||||||
console.warn(`The server that already has this IP is: ${AllServers[serverIp].hostname}`);
|
console.warn(`The server that already has this IP is: ${AllServers[server.hostname].hostname}`);
|
||||||
throw new Error("Error: Trying to add a server with an existing IP");
|
throw new Error("Error: Trying to add a server with an existing IP");
|
||||||
}
|
}
|
||||||
|
|
||||||
AllServers[serverIp] = server;
|
console.log(`adding ${server.hostname}`);
|
||||||
|
AllServers[server.hostname] = server;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IServerParams {
|
interface IServerParams {
|
||||||
|
Loading…
Reference in New Issue
Block a user