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

Method Authenticate

src/ClientHandle.cpp:191–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189
190
191void cClientHandle::Authenticate(void)
192{
193 if (m_State != csAuthenticating)
194 {
195 return;
196 }
197
198 ASSERT( m_Player == NULL );
199
200 // Spawn player (only serversided, so data is loaded)
201 m_Player = new cPlayer(this, GetUsername());
202
203 cWorld * World = cRoot::Get()->GetWorld(m_Player->GetLoadedWorldName());
204 if (World == NULL)
205 {
206 World = cRoot::Get()->GetDefaultWorld();
207 }
208
209 if (m_Player->GetGameMode() == eGameMode_NotSet)
210 {
211 m_Player->LoginSetGameMode(World->GetGameMode());
212 }
213
214 m_Player->SetIP (m_IPString);
215
216 if (!cRoot::Get()->GetPluginManager()->CallHookPlayerJoined(*m_Player))
217 {
218 cRoot::Get()->BroadcastChatJoin(Printf("%s has joined the game", GetUsername().c_str()));
219 LOGINFO("Player %s has joined the game.", m_Username.c_str());
220 }
221
222 m_ConfirmPosition = m_Player->GetPosition();
223
224 // Return a server login packet
225 m_Protocol->SendLogin(*m_Player, *World);
226
227 // Send Weather if raining:
228 if ((World->GetWeather() == 1) || (World->GetWeather() == 2))
229 {
230 m_Protocol->SendWeather(World->GetWeather());
231 }
232
233 // Send time
234 m_Protocol->SendTimeUpdate(World->GetWorldAge(), World->GetTimeOfDay());
235
236 // Send contents of the inventory window
237 m_Protocol->SendWholeInventory(*m_Player->GetWindow());
238
239 // Send health
240 m_Player->SendHealth();
241
242 // Send experience
243 m_Player->SendExperience();
244
245 m_Player->Initialize(World);
246 m_State = csAuthenticated;
247
248 // Query player team

Callers 2

AuthenticateUserMethod · 0.45
HandleLoginMethod · 0.45

Calls 15

PrintfFunction · 0.85
LOGINFOFunction · 0.85
GetDefaultWorldMethod · 0.80
LoginSetGameModeMethod · 0.80
SetIPMethod · 0.80
CallHookPlayerJoinedMethod · 0.80
GetPluginManagerMethod · 0.80
BroadcastChatJoinMethod · 0.80
c_strMethod · 0.80
GetWeatherMethod · 0.80
GetWorldAgeMethod · 0.80
GetTimeOfDayMethod · 0.80

Tested by

no test coverage detected