예제 #1
0
 @Override
 public void serialize(Buffer buf) {
   buf.writeString(name);
   buf.writeShort(worldX);
   buf.writeShort(worldY);
   buf.writeString(ownername);
 }
예제 #2
0
 @Override
 public void deserialize(Buffer buf) {
   name = buf.readString();
   worldX = buf.readShort();
   if (worldX < -255 || worldX > 255)
     throw new RuntimeException(
         "Forbidden value on worldX = "
             + worldX
             + ", it doesn't respect the following condition : worldX < -255 || worldX > 255");
   worldY = buf.readShort();
   if (worldY < -255 || worldY > 255)
     throw new RuntimeException(
         "Forbidden value on worldY = "
             + worldY
             + ", it doesn't respect the following condition : worldY < -255 || worldY > 255");
   ownername = buf.readString();
 }
예제 #3
0
 @Override
 public void deserialize(Buffer buf) {
   houseId = buf.readInt();
   if (houseId < 0)
     throw new RuntimeException(
         "Forbidden value on houseId = "
             + houseId
             + ", it doesn't respect the following condition : houseId < 0");
 }
예제 #4
0
 @Override
 public void deserialize(Buffer buf) {
   objectUID = buf.readInt();
   if (objectUID < 0)
     throw new RuntimeException(
         "Forbidden value on objectUID = "
             + objectUID
             + ", it doesn't respect the following condition : objectUID < 0");
   foodUID = buf.readInt();
   if (foodUID < 0)
     throw new RuntimeException(
         "Forbidden value on foodUID = "
             + foodUID
             + ", it doesn't respect the following condition : foodUID < 0");
   foodQuantity = buf.readShort();
   if (foodQuantity < 0)
     throw new RuntimeException(
         "Forbidden value on foodQuantity = "
             + foodQuantity
             + ", it doesn't respect the following condition : foodQuantity < 0");
 }
예제 #5
0
 @Override
 public void serialize(Buffer buf) {
   buf.writeInt(houseId);
 }
예제 #6
0
 @Override
 public void serialize(Buffer buf) {
   buf.writeInt(objectUID);
   buf.writeInt(foodUID);
   buf.writeShort(foodQuantity);
 }
예제 #7
0
 @Override
 public void serialize(Buffer buf) {
   buf.writeInt(kickedId);
 }
 @Override
 public void deserialize(Buffer buf) {
   super.deserialize(buf);
   loyal = buf.readBoolean();
 }
 @Override
 public void serialize(Buffer buf) {
   super.serialize(buf);
   buf.writeBoolean(loyal);
 }