MCPcopy Create free account
hub / github.com/cuberite/cuberite / ParseLogin

Method ParseLogin

src/Protocol/Protocol125.cpp:1398–1433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1396
1397
1398int cProtocol125::ParseLogin(void)
1399{
1400 HANDLE_PACKET_READ(ReadBEInt, int, ProtocolVersion);
1401 HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Username);
1402 HANDLE_PACKET_READ(ReadBEUTF16String16, AString, LevelType);
1403 HANDLE_PACKET_READ(ReadBEInt, int, ServerMode);
1404 HANDLE_PACKET_READ(ReadBEInt, int, Dimension);
1405 HANDLE_PACKET_READ(ReadChar, char, Difficulty);
1406 HANDLE_PACKET_READ(ReadByte, Byte, WorldHeight);
1407 HANDLE_PACKET_READ(ReadByte, Byte, MaxPlayers);
1408
1409 if (ProtocolVersion < 29)
1410 {
1411 m_Client->Kick("Your client is outdated!");
1412 return PARSE_OK;
1413 }
1414 else if (ProtocolVersion > 29)
1415 {
1416 m_Client->Kick("Your client version is higher than the server!");
1417 return PARSE_OK;
1418 }
1419
1420 if (m_Username.compare(Username) != 0)
1421 {
1422 LOGWARNING("Login Username (\"%s\") does not match Handshake username (\"%s\") for client @ \"%s\", kicking",
1423 Username.c_str(),
1424 m_Username.c_str(),
1425 m_Client->GetIPString().c_str()
1426 );
1427 m_Client->Kick("Hacked client"); // Don't tell them why we don't want them
1428 return PARSE_OK;
1429 }
1430
1431 m_Client->HandleLogin(ProtocolVersion, Username);
1432 return PARSE_OK;
1433}
1434
1435
1436

Callers

nothing calls this directly

Calls 4

KickMethod · 0.80
compareMethod · 0.80
c_strMethod · 0.80
HandleLoginMethod · 0.80

Tested by

no test coverage detected