Package networking.request

Source Code of networking.request.RequestGetPlayerWorlds

package networking.request;

import dataAccessLayer.WorldDAO;

import java.io.IOException;

import metadata.Constants;

import networking.response.ResponseGetPlayerWorlds;
import utility.DataReader;

/**
*
* @author Gary
*/
public class RequestGetPlayerWorlds extends GameRequest {

    // Data
    private int player_id;
    // Responses
    private ResponseGetPlayerWorlds responseGetPlayerWorlds;

    public RequestGetPlayerWorlds() {
        responses.add(responseGetPlayerWorlds = new ResponseGetPlayerWorlds());
    }

    @Override
    public void parse() throws IOException {
        player_id = DataReader.readInt(dataInput);

        if (player_id == 0) {
            player_id = client.getPlayer().getID();
        }
    }

    @Override
    public void doBusiness() throws Exception {
        responseGetPlayerWorlds.setWorlds(WorldDAO.getPlayerWorlds(player_id));

        client.getServer().trackPlayerPosition(client.getPlayer().getID(), Constants.LOCATION_PVE_G_LOBBY);
    }
}
TOP

Related Classes of networking.request.RequestGetPlayerWorlds

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.