Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.46 KB | None | 0 0
  1. package org.dh.apichecker;
  2.  
  3. import io.swagger.client.api.UniverseApi;
  4. import io.swagger.client.model.GetUniverseRaces200Ok;
  5.  
  6. import java.util.List;
  7.  
  8. import static org.dh.apichecker.Main.ap;
  9.  
  10. public class race {
  11.     //Race Vars
  12.     static int race_id;
  13.     static String name;
  14.     static String description;
  15.     static int alliance_id;
  16.     //Race Vars
  17.  
  18.     //Race Constructor
  19.     public race(int race_id) {
  20.         this.race_id = race_id;
  21.         buildRace(race_id);
  22.     }
  23.     //Race Constructor
  24.     ////////////////////////////////////
  25.     public  static void buildRace(int race_id){
  26.         try {
  27.             List<GetUniverseRaces200Ok> resp =
  28.                     new UniverseApi(ap).getUniverseRaces(null, null, null, null);
  29.             for(GetUniverseRaces200Ok race : resp) {
  30.                 if (race.getRaceId() == race_id) {
  31.                     name = race.getName();
  32.                     description = race.getDescription();
  33.                     alliance_id = race.getAllianceId();
  34.                 }
  35.             }
  36.         } catch (Exception e) {
  37.             e.printStackTrace();
  38.         }
  39.     }
  40.     ////////////////////////////////////
  41.     //Race Getters
  42.     public int getRace_id() {
  43.         return race_id;
  44.     }
  45.     public String getName() {
  46.         return name;
  47.     }
  48.     public String getDescription() {
  49.         return description;
  50.     }
  51.     public int getAlliance_id() {
  52.         return alliance_id;
  53.     }
  54.     //Race Getters
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement