pub fn from_stream(mut stream: Box<TcpStream>) -> Option<Player> {
        let mut login_packet = match Packet::new(&mut stream) {
            Ok(p) => p,
            _ => {
                println!("Error Logging player In");
                return None;
            },
        };
        let player_name = login_packet.get_string();

        let mut hash = SipHasher::new();
        stream.peer_addr().unwrap().ip().hash(&mut hash);
        hash.write(player_name.as_bytes());

        // Sends `RecieveverData`, can be either from tcp in, or other threads
        // We need to notify player thread, incase Something needs to be updated.
        let (to_player,  data_rx) = channel();
        
        let to_player_clone = to_player.clone();
        //let stream_clone = stream.try_clone().unwrap();
        //thread::spawn(move || packet::form_packet(stream_clone, to_player_clone));

        Some(Player {
            eid: hash.finish() as u32,
            name: player_name,
            chunks: Vec::new(),
            location: Location::new(),
            yaw: 0.0,
            pitch: 0.0,
            respawn: Location::new(),
            last_on_ground: Location::new(),
            health: 20,
            food: 20,
            food_saturation: 5.0,
            world_type: 0,
            game_mode: 1,
            reputation: 0,
            tx: to_player,
            rx: data_rx,
            stream: stream
        })
    }
// Logins in player if existing found, or creates new
// Feature: record and check
Logins in player if existing found, or creates new
Feature: record and check
Logins in player if existing found or creates new Feature : record and check
pub fn from_stream(mut stream: Box<TcpStream>) -> Option<Player> {
        let mut login_packet = match Packet::new(&mut stream) {
            Ok(p) => p,
            _ => {
                println!("Error Logging player In");
                return None;
            },
        };
        let player_name = login_packet.get_string();
        let mut hash = SipHasher::new();
        stream.peer_addr().unwrap().ip().hash(&mut hash);
        hash.write(player_name.as_bytes());
        // Sends `RecieveverData`, can be either from tcp in, or other threads
        // We need to notify player thread, incase Something needs to be updated.
        let (to_player,  data_rx) = channel();
        let to_player_clone = to_player.clone();
        //let stream_clone = stream.try_clone().unwrap();
        //thread::spawn(move || packet::form_packet(stream_clone, to_player_clone));
        Some(Player {
            eid: hash.finish() as u32,
            name: player_name,
            chunks: Vec::new(),
            location: Location::new(),
            yaw: 0.0,
            pitch: 0.0,
            respawn: Location::new(),
            last_on_ground: Location::new(),
            health: 20,
            food: 20,
            food_saturation: 5.0,
            world_type: 0,
            game_mode: 1,
            reputation: 0,
            tx: to_player,
            rx: data_rx,
            stream: stream
        })
    }
pub fn from_stream ( mut stream : Box < TcpStream > ) -> Option < Player > { let mut login_packet = match Packet :: new ( & mut stream ) { Ok ( p ) => p , _ => { println ! ( " " ) ; return None ; } , } ; let player_name = login_packet . get_string ( ) ; let mut hash = SipHasher :: new ( ) ; stream . peer_addr ( ) . unwrap ( ) . ip ( ) . hash ( & mut hash ) ; hash . write ( player_name . as_bytes ( ) ) ; // Sends `RecieveverData`, can be either from tcp in, or other threads // We need to notify player thread, incase Something needs to be updated. let ( to_player , data_rx ) = channel ( ) ; let to_player_clone = to_player . clone ( ) ; //let stream_clone = stream.try_clone().unwrap(); //thread::spawn(move || packet::form_packet(stream_clone, to_player_clone)); Some ( Player { eid : hash . finish ( ) as u32 , name : player_name , chunks : Vec :: new ( ) , location : Location :: new ( ) , yaw : 0.0 , pitch : 0.0 , respawn : Location :: new ( ) , last_on_ground : Location :: new ( ) , health : 20 , food : 20 , food_saturation : 5.0 , world_type : 0 , game_mode : 1 , reputation : 0 , tx : to_player , rx : data_rx , stream : stream } ) }
Logins in player if existing found, or creates new
Feature: record and check
Logins in player if existing found or creates new Feature : record and check
stream
Box<TcpStream>
stream
Box<TcpStream>