diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-11-02 21:19:57 +0100 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-11-02 21:19:57 +0100 |
commit | dada2bea27bbc0b5dec68e8089ce5b8c296baabd (patch) | |
tree | c87790fa9c5ce89bddb126c94a3a90fb13ce9478 /source/cClientHandle.cpp | |
parent | Fixed player spawn teleport postion. (diff) | |
download | cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar.gz cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar.bz2 cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar.lz cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar.xz cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar.zst cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cClientHandle.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index a694ea97e..621e8a19e 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -432,7 +432,9 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) }
// Now initialize player (adds to entity list etc.)
- m_Player->Initialize( cRoot::Get()->GetDefaultWorld() ); // TODO - Get correct world for player
+ cWorld* PlayerWorld = cRoot::Get()->GetWorld( m_Player->GetLoadedWorldName() );
+ if( !PlayerWorld ) PlayerWorld = cRoot::Get()->GetDefaultWorld();
+ m_Player->Initialize( PlayerWorld ); // TODO - Get correct world for player
// Broadcasts to all but this ( this is actually handled in cChunk.cpp, after entity is added to the chunk )
//m_Player->SpawnOn( 0 );
@@ -937,13 +939,15 @@ void cClientHandle::Tick(float a_Dt) {
m_bSendLoginResponse = false;
- cWorld* World = cRoot::Get()->GetDefaultWorld(); // TODO - Get the correct world or better yet, move this to the main thread so we don't have to lock anything
- World->LockEntities();
// Spawn player (only serversided, so data is loaded)
m_Player = new cPlayer( this, GetUsername() ); // !!DO NOT INITIALIZE!! <- is done after receiving MoveLook Packet
+
+ cWorld* World = cRoot::Get()->GetWorld( m_Player->GetLoadedWorldName() ); // TODO - Get the correct world or better yet, move this to the main thread so we don't have to lock anything
+ if( !World ) World = cRoot::Get()->GetDefaultWorld();
+ World->LockEntities();
m_Player->SetGameMode ( World->GetGameMode() ); //set player's gamemode to server's gamemode at login.
- cRoot::Get()->GetPluginManager()->CallHook( cPluginManager::E_PLUGIN_PLAYER_SPAWN, 1, m_Player ); // TODO - this function is called from a seperate thread, which might be dangerous
+ cRoot::Get()->GetPluginManager()->CallHook( cPluginManager::E_PLUGIN_PLAYER_SPAWN, 1, m_Player );
// Return a server login packet
cPacket_Login LoginResponse;
|