Sync with L2JServer Jan 9th 2015.
This commit is contained in:
@@ -34,7 +34,6 @@ import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javolution.io.UTF8StreamReader;
|
||||
@@ -185,17 +184,17 @@ public final class GameServerTable
|
||||
* @param gsi the game server information DTO
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean registerWithFirstAvaliableId(GameServerInfo gsi)
|
||||
public boolean registerWithFirstAvailableId(GameServerInfo gsi)
|
||||
{
|
||||
// avoid two servers registering with the same "free" id
|
||||
synchronized (_gameServerTable)
|
||||
{
|
||||
for (Entry<Integer, String> entry : _serverNames.entrySet())
|
||||
for (Integer serverId : _serverNames.keySet())
|
||||
{
|
||||
if (!_gameServerTable.containsKey(entry.getKey()))
|
||||
if (!_gameServerTable.containsKey(serverId))
|
||||
{
|
||||
_gameServerTable.put(entry.getKey(), gsi);
|
||||
gsi.setId(entry.getKey());
|
||||
_gameServerTable.put(serverId, gsi);
|
||||
gsi.setId(serverId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -217,7 +216,6 @@ public final class GameServerTable
|
||||
if (!_gameServerTable.containsKey(id))
|
||||
{
|
||||
_gameServerTable.put(id, gsi);
|
||||
gsi.setId(id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -381,6 +379,12 @@ public final class GameServerTable
|
||||
return _hexId;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
// this value can't be stored in a private variable because the ID can be changed by setId()
|
||||
return GameServerTable.getInstance().getServerNameById(_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the authed.
|
||||
* @param isAuthed the new authed
|
||||
@@ -435,6 +439,20 @@ public final class GameServerTable
|
||||
return _status;
|
||||
}
|
||||
|
||||
public String getStatusName()
|
||||
{
|
||||
switch (_status)
|
||||
{
|
||||
case 0: return "Auto";
|
||||
case 1: return "Good";
|
||||
case 2: return "Normal";
|
||||
case 3: return "Full";
|
||||
case 4: return "Down";
|
||||
case 5: return "GM Only";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current player count.
|
||||
* @return the current player count
|
||||
|
@@ -129,7 +129,7 @@ public class GameServerAuth extends BaseRecievePacket
|
||||
if (Config.ACCEPT_NEW_GAMESERVER && _acceptAlternativeId)
|
||||
{
|
||||
gsi = new GameServerInfo(id, hexId, _server);
|
||||
if (gameServerTable.registerWithFirstAvaliableId(gsi))
|
||||
if (gameServerTable.registerWithFirstAvailableId(gsi))
|
||||
{
|
||||
_server.attachGameServerInfo(gsi, _port, _hosts, _maxPlayers);
|
||||
gameServerTable.registerServerOnDB(gsi);
|
||||
|
@@ -32,16 +32,6 @@ public class ServerStatus extends BaseRecievePacket
|
||||
{
|
||||
protected static Logger _log = Logger.getLogger(ServerStatus.class.getName());
|
||||
|
||||
public static final String[] STATUS_STRING =
|
||||
{
|
||||
"Auto",
|
||||
"Good",
|
||||
"Normal",
|
||||
"Full",
|
||||
"Down",
|
||||
"Gm Only"
|
||||
};
|
||||
|
||||
public static final int SERVER_LIST_STATUS = 0x01;
|
||||
public static final int SERVER_TYPE = 0x02;
|
||||
public static final int SERVER_LIST_SQUARE_BRACKET = 0x03;
|
||||
|
Reference in New Issue
Block a user