public virtual void DoLogin(net.minecraft.src.Packet1Login packet1login)
        {
            net.minecraft.src.EntityPlayerMP entityplayermp = mcServer.serverConfigurationManager.Login(this, packet1login.username);
            if (entityplayermp != null)
            {
                mcServer.serverConfigurationManager.ReadPlayerDataFromFile(entityplayermp);
                entityplayermp.SetWorldHandler(mcServer.GetWorldServer(entityplayermp.dimension));

                //TODO: Cleanup all java.lang.StringBuilder instances
                //logger.Info((new java.lang.StringBuilder()).Append(GetUserAndIPString()).Append(" logged in with entity id ").Append(entityplayermp.entityId).Append(" at (").Append(entityplayermp.posX).Append(", ").Append(entityplayermp.posY).Append(", ").Append(entityplayermp.posZ).Append(")").ToString());
                logger.Info($"{GetUserAndIPString()} logged in with entity id {entityplayermp.entityId} at ({entityplayermp.posX}, {entityplayermp.posY}, {entityplayermp.posZ})");

                net.minecraft.src.WorldServer      worldserver      = mcServer.GetWorldServer(entityplayermp.dimension);
                net.minecraft.src.ChunkCoordinates chunkcoordinates = worldserver.GetSpawnPoint();
                net.minecraft.src.NetServerHandler netserverhandler = new net.minecraft.src.NetServerHandler(mcServer, netManager, entityplayermp);

                netserverhandler.SendPacket(new net.minecraft.src.Packet1Login(string.Empty, entityplayermp.entityId, worldserver.GetSeed(), unchecked ((byte)worldserver.worldProvider.worldType)));
                netserverhandler.SendPacket(new net.minecraft.src.Packet6SpawnPosition(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ));

                mcServer.serverConfigurationManager.Func_28170_a(entityplayermp, worldserver);

                //TODO: Defer login message to hook
                //mcServer.configManager.SendPacketToAllPlayers(new net.minecraft.src.Packet3Chat((new java.lang.StringBuilder()).Append("\xf7e").Append(entityplayermp.username).Append(" joined the game.").ToString()));
                mcServer.serverConfigurationManager.SendPacketToAllPlayers(new net.minecraft.src.Packet3Chat($"§e{entityplayermp.username} joined the game."));
                mcServer.serverConfigurationManager.PlayerLoggedIn(entityplayermp);

                netserverhandler.TeleportTo(entityplayermp.posX, entityplayermp.posY, entityplayermp.posZ, entityplayermp.rotationYaw, entityplayermp.rotationPitch);
                mcServer.networkServer.AddPlayer(netserverhandler);

                netserverhandler.SendPacket(new net.minecraft.src.Packet4UpdateTime(worldserver.GetWorldTime()));

                entityplayermp.Func_20057_k();
            }
            finishedProcessing = true;
        }
 public virtual void HandleNetworkListenThread()
 {
     for (int i = 0; i < pendingConnections.Count; i++)
     {
         net.minecraft.src.NetLoginHandler netloginhandler = (net.minecraft.src.NetLoginHandler)pendingConnections[i];
         try
         {
             netloginhandler.TryLogin();
         }
         catch (System.Exception exception)
         {
             netloginhandler.KickUser("Internal server error");
             logger.Warning((new java.lang.StringBuilder()).Append("Failed to handle packet: ").Append(exception).ToString());
             logger.Log(exception.ToString());
         }
         if (netloginhandler.finishedProcessing)
         {
             pendingConnections.RemoveAt(i--);
         }
         netloginhandler.netManager.InterruptThreads();
     }
     for (int j = 0; j < playerList.Count; j++)
     {
         net.minecraft.src.NetServerHandler netserverhandler = (net.minecraft.src.NetServerHandler)playerList[j];
         try
         {
             netserverhandler.HandlePackets();
         }
         catch (System.Exception exception1)
         {
             logger.Warning((new java.lang.StringBuilder()).Append("Failed to handle packet: ").Append(exception1).ToString());
             logger.Log(exception1.ToString());
             netserverhandler.KickPlayer("Internal server error");
         }
         if (netserverhandler.disconnected)
         {
             playerList.RemoveAt(j--);
         }
         netserverhandler.netManager.InterruptThreads();
     }
 }
 public virtual void AddPlayer(net.minecraft.src.NetServerHandler netserverhandler)
 {
     playerList.Add(netserverhandler);
 }