@Override
 public byte[] constructResponseInBytes() {
   // TODO Auto-generated method stub
   GamePacket packet = new GamePacket(responseCode);
   // add the data need to pass to the client here
   return packet.getBytes();
 }
 @Override
 public byte[] constructResponseInBytes() {
   GamePacket packet = new GamePacket(responseCode);
   packet.addString(username);
   packet.addString(character);
   return packet.getBytes();
 }
 @Override
 public byte[] constructResponseInBytes() {
   GamePacket packet = new GamePacket(responseCode);
   packet.addShort16(type);
   packet.addInt32(amount);
   packet.addInt32(target);
   return packet.getBytes();
 }
 @Override
 public byte[] constructResponseInBytes() {
   // TODO Auto-generated method stub
   GamePacket packet = new GamePacket(responseCode);
   packet.addString(player.getUsername());
   packet.addFloat(player.getPosition().getX());
   packet.addFloat(player.getPosition().getY());
   packet.addFloat(player.getPosition().getZ());
   packet.addFloat(player.getPosition().getH());
   packet.addFloat(player.getPosition().getP());
   packet.addFloat(player.getPosition().getR());
   packet.addInt32(this.forward);
   packet.addInt32(this.backward);
   packet.addInt32(this.right);
   packet.addInt32(this.left);
   return packet.getBytes();
 }
 @Override
 public byte[] constructResponseInBytes() {
   // TODO Auto-generated method stub
   GamePacket packet = new GamePacket(responseCode);
   System.out.println(
       "Sending Protocol: " + responseCode + " class: " + this.getClass().getName());
   packet.addString(player.getUsername());
   packet.addFloat(player.getPosition().getSteering());
   packet.addFloat(player.getPosition().getWheelforce());
   packet.addFloat(player.getPosition().getBrakeforce());
   packet.addFloat(player.getPosition().getX());
   packet.addFloat(player.getPosition().getY());
   packet.addFloat(player.getPosition().getZ());
   packet.addFloat(player.getPosition().getH());
   packet.addFloat(player.getPosition().getP());
   packet.addFloat(player.getPosition().getR());
   return packet.getBytes();
 }
Esempio n. 6
0
 @Override
 public byte[] constructResponseInBytes() {
   GamePacket packet = new GamePacket(responseCode);
   /*Construct packet*/
   return packet.getBytes();
 }