Package utility

Examples of utility.GamePacket.addString()


    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16(status);
        if (status == 0) {
            packet.addString(world.getGameName());
            packet.addShort16((short) world.getGameMode());
        }
//        if (status == 0) {
//            if (world.getGameMode() == Constants.GAME_TYPE_PVP) {
//                packet.addShort16((short) 1);
View Full Code Here


        GamePacket packet = new GamePacket(responseCode);
        if (pvpPlayers != null) {
            numberOfPlayers = (short) pvpPlayers.size();
            packet.addShort16(numberOfPlayers);
            for (String player : pvpPlayers) {
                packet.addString(player);
            }
        }

        return packet.getBytes();
    }
View Full Code Here

    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16((short) pvpWorlds.size());

        for (World world : pvpWorlds) {
            packet.addString(world.getGameName());
            packet.addShort16((short) world.getEnvironments().size());
            packet.addShort16((short) world.getMaxPlayers());
            packet.addString(world.getEnvType());
        }
View Full Code Here

                if (species.getGroupType() == Constants.ORGANISM_TYPE_PLANT) {
                    PlantType plant = (PlantType) species;

                    packet.addShort16((short) plant.getID());
                    packet.addString(plant.getSpeciesName());
                    packet.addString(plant.getDescription());
                    packet.addString(plant.getCategory());
                    packet.addShort16((short) plant.getCost());

                    String predatorList = "";
View Full Code Here

                if (species.getGroupType() == Constants.ORGANISM_TYPE_PLANT) {
                    PlantType plant = (PlantType) species;

                    packet.addShort16((short) plant.getID());
                    packet.addString(plant.getSpeciesName());
                    packet.addString(plant.getDescription());
                    packet.addString(plant.getCategory());
                    packet.addShort16((short) plant.getCost());

                    String predatorList = "";
                    for (SpeciesType predator : plant.getPredatorList(Constants.ORGANISM_TYPE_ANIMAL)) {
View Full Code Here

                    PlantType plant = (PlantType) species;

                    packet.addShort16((short) plant.getID());
                    packet.addString(plant.getSpeciesName());
                    packet.addString(plant.getDescription());
                    packet.addString(plant.getCategory());
                    packet.addShort16((short) plant.getCost());

                    String predatorList = "";
                    for (SpeciesType predator : plant.getPredatorList(Constants.ORGANISM_TYPE_ANIMAL)) {
                        predatorList += predator.getSpeciesName() + ", ";
View Full Code Here

                    }
                    if (predatorList.endsWith(", ")) {
                        predatorList = predatorList.substring(0, predatorList.lastIndexOf(","));
                    }

                    packet.addString(predatorList);
                    packet.addInt32(plant.getModelID());
                    packet.addInt32((int) plant.getAvgBiomass());
                } else if (species.getGroupType() == Constants.ORGANISM_TYPE_ANIMAL) {
                    AnimalType animal = (AnimalType) species;
View Full Code Here

                    packet.addInt32((int) plant.getAvgBiomass());
                } else if (species.getGroupType() == Constants.ORGANISM_TYPE_ANIMAL) {
                    AnimalType animal = (AnimalType) species;

                    packet.addShort16((short) animal.getID());
                    packet.addString(animal.getSpeciesName());
                    packet.addString(animal.getDescription());
                    packet.addString(animal.getCategory());
                    packet.addShort16((short) animal.getCost());

                    String predatorList = "";
View Full Code Here

                } else if (species.getGroupType() == Constants.ORGANISM_TYPE_ANIMAL) {
                    AnimalType animal = (AnimalType) species;

                    packet.addShort16((short) animal.getID());
                    packet.addString(animal.getSpeciesName());
                    packet.addString(animal.getDescription());
                    packet.addString(animal.getCategory());
                    packet.addShort16((short) animal.getCost());

                    String predatorList = "";
                    for (SpeciesType predator : animal.getPredatorList(Constants.ORGANISM_TYPE_ANIMAL)) {
View Full Code Here

                    AnimalType animal = (AnimalType) species;

                    packet.addShort16((short) animal.getID());
                    packet.addString(animal.getSpeciesName());
                    packet.addString(animal.getDescription());
                    packet.addString(animal.getCategory());
                    packet.addShort16((short) animal.getCost());

                    String predatorList = "";
                    for (SpeciesType predator : animal.getPredatorList(Constants.ORGANISM_TYPE_ANIMAL)) {
                        predatorList += predator.getSpeciesName() + ", ";
View Full Code Here

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.