Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
  }
Ejemplo n.º 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;
  }