MCPcopy Create free account
hub / github.com/demoth/jake2 / gotnewcl

Method gotnewcl

server/src/main/java/jake2/server/SV_MAIN.java:311–351  ·  view source on GitHub ↗

Initializes player structures after successfull connection.

(int i, int challenge, String userinfo, netadr_t adr, int qport)

Source from the content-addressed store, hash-verified

309 * Initializes player structures after successfull connection.
310 */
311 private void gotnewcl(int i, int challenge, String userinfo, netadr_t adr, int qport) {
312 // build a new connection
313 // accept the new client
314 // this is the only place a client_t is ever initialized
315
316 final client_t client = clients.get(i);
317 GameImportsImpl gameImports = games.get("default");
318 client.gameName = "default";
319
320 edict_t ent = gameImports.gameExports.getEdict(i + 1);
321 client.edict = ent; // fixme: why? isn't it already set?
322
323 // save challenge for checksumming
324 client.challenge = challenge;
325
326 // get the game a chance to reject this connection or modify the
327 // userinfo
328 if (!(gameImports.gameExports.ClientConnect(ent, userinfo))) {
329 if (Info.Info_ValueForKey(userinfo, "rejmsg") != null) {
330 Netchan.sendConnectionlessPacket(Defines.NS_SERVER, adr, ConnectionlessCommand.print, "\n" + Info.Info_ValueForKey(userinfo, "rejmsg") + "\nConnection refused.\n");
331 } else {
332 Netchan.sendConnectionlessPacket(Defines.NS_SERVER, adr, ConnectionlessCommand.print, "\nConnection refused.\n");
333 }
334 Com.DPrintf("Game rejected a connection.\n");
335 return;
336 }
337
338 // parse some info from the info strings
339 client.userinfo = userinfo;
340 SV_UserinfoChanged(client);
341
342 Netchan.sendConnectionlessPacket(Defines.NS_SERVER, adr, ConnectionlessCommand.client_connect, "");
343
344 client.netchan.setup(Defines.NS_SERVER, adr, qport);
345
346 client.state = ClientStates.CS_CONNECTED;
347
348 client.lastmessage = gameImports.realtime; // don't timeout
349 client.lastconnect = gameImports.realtime;
350 Com.DPrintf("new client added.\n");
351 }
352
353 /**
354 * Checks if the rcon password is corect.

Callers 1

SVC_DirectConnectMethod · 0.95

Calls 8

Info_ValueForKeyMethod · 0.95
DPrintfMethod · 0.95
SV_UserinfoChangedMethod · 0.95
getEdictMethod · 0.65
ClientConnectMethod · 0.65
getMethod · 0.45
setupMethod · 0.45

Tested by

no test coverage detected