mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-28 02:23:53 +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
|
||||
export function AddToAllServers(server: Server | HacknetServer): void {
|
||||
const serverIp = server.ip;
|
||||
if (ipExists(serverIp)) {
|
||||
console.warn(`IP of server that's being added: ${serverIp}`);
|
||||
if (GetServer(server.hostname)) {
|
||||
console.warn(`IP of server that's being added: ${server.ip}`);
|
||||
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");
|
||||
}
|
||||
|
||||
AllServers[serverIp] = server;
|
||||
console.log(`adding ${server.hostname}`);
|
||||
AllServers[server.hostname] = server;
|
||||
}
|
||||
|
||||
interface IServerParams {
|
||||
|
Loading…
Reference in New Issue
Block a user