Package packets.c2spackets

Source Code of packets.c2spackets.P0x02

package packets.c2spackets;

import network.MCConnection;
import exceptions.UnrecoverableException;
import packets.PacketHandler;
import packets.s2cpackets.S0x02;
import world.WorldState;

public class P0x02 extends PacketHandler {

  public P0x02(WorldState state) {
    super(state);
  }

  @Override
  public void handle(MCConnection conn) throws UnrecoverableException {
    /**
     * Receiving 1 string from the server, holding connection info.
     * It is formatted in the following way:
     *   USERNAME;HOSTNAME;PORTNUMBER
     */
    String connectioninfo = conn.r.readString();
   
    String username = connectioninfo.split(";")[0];
    System.out.println("User tries to connect: "+username);
   
    //return "-", meaning that this server will not use authentication.
    conn.send(new S0x02());
  }

}
TOP

Related Classes of packets.c2spackets.P0x02

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.