Proper fix for server generating HexID each time it connects to the login.
This commit is contained in:
parent
e344c6a7ad
commit
34e1aa5a90
@ -2542,12 +2542,15 @@ public final class Config
|
|||||||
final Properties hexSetting = new Properties();
|
final Properties hexSetting = new Properties();
|
||||||
final File file = new File(fileName);
|
final File file = new File(fileName);
|
||||||
// Create a new empty file only if it doesn't exist
|
// Create a new empty file only if it doesn't exist
|
||||||
file.createNewFile();
|
if (!file.exists())
|
||||||
try (OutputStream out = new FileOutputStream(file))
|
|
||||||
{
|
{
|
||||||
hexSetting.setProperty("ServerID", String.valueOf(serverId));
|
try (OutputStream out = new FileOutputStream(file))
|
||||||
hexSetting.setProperty("HexID", hexId);
|
{
|
||||||
hexSetting.store(out, "The HexId to Auth into LoginServer");
|
hexSetting.setProperty("ServerID", String.valueOf(serverId));
|
||||||
|
hexSetting.setProperty("HexID", hexId);
|
||||||
|
hexSetting.store(out, "The HexId to Auth into LoginServer");
|
||||||
|
LOGGER.log(Level.INFO, "Gameserver: Generated new HexID file for server id " + serverId + ".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -245,7 +245,7 @@ public class LoginServerThread extends Thread
|
|||||||
final AuthResponse aresp = new AuthResponse(incoming);
|
final AuthResponse aresp = new AuthResponse(incoming);
|
||||||
final int serverID = aresp.getServerId();
|
final int serverID = aresp.getServerId();
|
||||||
_serverName = aresp.getServerName();
|
_serverName = aresp.getServerName();
|
||||||
// Config.saveHexid(serverID, hexToString(_hexID));
|
Config.saveHexid(serverID, hexToString(_hexID));
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Registered on login as Server " + serverID + ": " + _serverName);
|
LOGGER.info(getClass().getSimpleName() + ": Registered on login as Server " + serverID + ": " + _serverName);
|
||||||
final ServerStatus st = new ServerStatus();
|
final ServerStatus st = new ServerStatus();
|
||||||
if (Config.SERVER_LIST_BRACKET)
|
if (Config.SERVER_LIST_BRACKET)
|
||||||
@ -529,6 +529,16 @@ public class LoginServerThread extends Thread
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hex to string.
|
||||||
|
* @param hex the hex value
|
||||||
|
* @return the hex value as string
|
||||||
|
*/
|
||||||
|
private String hexToString(byte[] hex)
|
||||||
|
{
|
||||||
|
return new BigInteger(hex).toString(16);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kick player for the given account.
|
* Kick player for the given account.
|
||||||
* @param account the account
|
* @param account the account
|
||||||
|
Loading…
Reference in New Issue
Block a user