Пример #1
0
  CraftMetaBook(Map<String, Object> map) {
    super(map);

    setAuthor(SerializableMeta.getString(map, BOOK_AUTHOR.BUKKIT, true));

    setTitle(SerializableMeta.getString(map, BOOK_TITLE.BUKKIT, true));

    Iterable<?> pages = SerializableMeta.getObject(Iterable.class, map, BOOK_PAGES.BUKKIT, true);
    CraftMetaItem.safelyAdd(pages, this.pages, MAX_PAGE_LENGTH);
  }
Пример #2
0
  CraftMetaPotion(Map<String, Object> map) {
    super(map);

    Iterable<?> rawEffectList =
        SerializableMeta.getObject(Iterable.class, map, POTION_EFFECTS.BUKKIT, true);
    if (rawEffectList == null) {
      return;
    }

    for (Object obj : rawEffectList) {
      if (!(obj instanceof PotionEffect)) {
        throw new IllegalArgumentException("Object in effect list is not valid. " + obj.getClass());
      }
      addCustomEffect((PotionEffect) obj, true);
    }
  }