Пример #1
0
 // FireworkEffect List
 public static JsonArray convertFireworkEffectList(Collection<FireworkEffect> fireworkEffects) {
   JsonArray ret = new JsonArray();
   for (FireworkEffect fe : fireworkEffects) {
     ret.add(FireworkEffectAdapter.toJson(fe));
   }
   return ret;
 }
Пример #2
0
 // PotionEffect List
 public static JsonArray convertPotionEffectList(Collection<PotionEffect> potionEffects) {
   JsonArray ret = new JsonArray();
   for (PotionEffect e : potionEffects) {
     ret.add(PotionEffectAdapter.toJson(e));
   }
   return ret;
 }
Пример #3
0
 // String List
 public static JsonArray convertStringList(Collection<String> strings) {
   JsonArray ret = new JsonArray();
   for (String string : strings) {
     ret.add(new JsonPrimitive(string));
   }
   return ret;
 }
Пример #4
0
  public static List<String> convertStringList(JsonElement jsonElement) {
    JsonArray array = jsonElement.getAsJsonArray();
    List<String> ret = new ArrayList<String>();

    Iterator<JsonElement> iter = array.iterator();
    while (iter.hasNext()) {
      JsonElement element = iter.next();
      ret.add(element.getAsString());
    }

    return ret;
  }
Пример #5
0
  public static List<FireworkEffect> convertFireworkEffectList(JsonElement jsonElement) {
    if (jsonElement == null) return null;
    if (!jsonElement.isJsonArray()) return null;
    JsonArray array = jsonElement.getAsJsonArray();

    List<FireworkEffect> ret = new ArrayList<FireworkEffect>();

    Iterator<JsonElement> iter = array.iterator();
    while (iter.hasNext()) {
      FireworkEffect fe = FireworkEffectAdapter.fromJson(iter.next());
      if (fe == null) continue;
      ret.add(fe);
    }

    return ret;
  }