Fixed a critical bug with the Management Server (no more lockouts weeee)

This commit is contained in:
ceikry 2021-07-13 21:12:07 -05:00
parent cc3b7546d4
commit 127ebc242e
6 changed files with 68 additions and 6 deletions

View file

@ -7,6 +7,7 @@ import ms.net.IoSession;
import ms.net.packet.IoBuffer;
import ms.world.info.CountryFlag;
import ms.world.info.WorldInfo;
import ms09.MSLogger;
/**
* Holds all the world servers.
@ -148,9 +149,25 @@ public class WorldDatabase {
throw new IllegalStateException("World " + info.getWorldId() + " is already registered!");
}
flagUpdate();
System.out.println("Registered world - [id=" + info.getWorldId() + ", ip=" + info.getAddress() + ", country=" + info.getCountry().name().toLowerCase() + ", revision=" + info.getRevision() + "]!");
MSLogger.logInfo("Registered world - [id=" + info.getWorldId() + ", ip=" + info.getAddress() + ", country=" + info.getCountry().name().toLowerCase() + ", revision=" + info.getRevision() + "]!");
return DATABASE[info.getWorldId()] = new GameServer(info);
}
public static void unRegister(GameServer server){
int index = -1;
for(int i = 0; i < DATABASE.length; i++){
GameServer s = DATABASE[i];
if(s == server){
index = i;
break;
}
}
if(index != -1){
DATABASE[index] = null;
WorldInfo info = server.getInfo();
MSLogger.logInfo("Unregistered world - [id=" + info.getWorldId() + ", ip=" + info.getAddress() + ", country=" + info.getCountry().name().toLowerCase() + ", revision=" + info.getRevision() + "]!");
}
}
/**
* Gets the world id of the player.