java类org.bukkit.inventory.meta.FireworkEffectMeta的实例源码

XMLItemMeta.java 文件源码 项目:Arcade2 阅读 19 收藏 0 点赞 0 评论 0
public static ItemMeta parse(Element xml, ItemMeta source) {
    if (source instanceof BannerMeta) {
        return parseBanner(xml, (BannerMeta) source);
    } else if (source instanceof BookMeta) {
        return parseBook(xml, (BookMeta) source);
    } else if (source instanceof EnchantmentStorageMeta) {
        return parseEnchantmentStorage(xml, (EnchantmentStorageMeta) source);
    } else if (source instanceof FireworkMeta) {
        return parseFirework(xml, (FireworkMeta) source);
    } else if (source instanceof FireworkEffectMeta) {
        return parseFireworkEffect(xml, (FireworkEffectMeta) source);
    } else if (source instanceof LeatherArmorMeta) {
        return parseLeatherArmor(xml, (LeatherArmorMeta) source);
    } else if (source instanceof MapMeta) {
        return parseMap(xml, (MapMeta) source);
    } else if (source instanceof PotionMeta) {
        return parsePotion(xml, (PotionMeta) source);
    } else if (source instanceof SkullMeta) {
        return parseSkull(xml, (SkullMeta) source);
    } else if (source instanceof SpawnEggMeta) {
        return parseSpawnEgg(xml, (SpawnEggMeta) source);
    }

    return source;
}
ItemMatcher.java 文件源码 项目:SupaCommons 阅读 18 收藏 0 点赞 0 评论 0
@Override
public boolean apply(@Nullable ItemStack item1, @Nullable ItemStack item2) {
  Boolean b = precondition(item1, item2, true);
  if (b != null) {
    return b;
  }
  if (item1.getItemMeta() instanceof FireworkMeta
      && item2.getItemMeta() instanceof FireworkMeta) {
    return ((FireworkMeta) item1.getItemMeta()).getEffects()
        .equals(((FireworkMeta) item2.getItemMeta()).getEffects());
  } else if (item1.getItemMeta() instanceof FireworkEffectMeta
             && item2.getItemMeta() instanceof FireworkEffectMeta) {
    return ((FireworkEffectMeta) item1.getItemMeta()).getEffect()
        .equals(((FireworkEffectMeta) item2.getItemMeta()).getEffect());
  }
  return false;
}
ItemBuilder.java 文件源码 项目:SupaCommons 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Removes a {@link FireworkEffect} by index from this item, assuming it is a firework. If it is
 * a
 * firework charge, its one and only effect is removed, disregarding the index given.
 * <p />
 * <b>UNSAFE</b>
 *
 * @param index index of the firework to remove
 *
 * @return this item builder instance, for chaining
 */
public ItemBuilder fireworkRemove(int index) {
  boolean b = isFireworkEffectMeta();
  if (b || isFireworkMeta()) {
    try {
      if (b) {
        ((FireworkEffectMeta) this.itemMeta).setEffect(null);
      } else {
        ((FireworkMeta) this.itemMeta).removeEffect(index);
      }
    } catch (Exception e) {
      if (!this.failSilently) {
        e.printStackTrace();
      }
    }
  }
  return this;
}
ItemBuilder.java 文件源码 项目:SupaCommons 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Clears all {@link FireworkEffect}s on this item, assuming it is a firework or firework charge.
 * <p />
 * <b>UNSAFE</b>
 *
 * @return this item builder instance, for chaining
 */
public ItemBuilder fireworkClear() {
  boolean b = isFireworkEffectMeta();
  if (b || isFireworkMeta()) {
    try {
      if (b) {
        ((FireworkEffectMeta) this.itemMeta).setEffect(null);
      } else {
        ((FireworkMeta) this.itemMeta).clearEffects();
      }
    } catch (Exception e) {
      if (!this.failSilently) {
        e.printStackTrace();
      }
    }
  }
  return this;
}
FireworkEffectData.java 文件源码 项目:TNE-Bukkit 阅读 19 收藏 0 点赞 0 评论 0
@Override
public SerialItemData initialize(ItemStack stack) {
  ItemMeta meta = stack.getItemMeta();
  if(meta instanceof FireworkEffectMeta) {
    valid = true;
    FireworkEffectMeta fireworkEffectMeta = (FireworkEffectMeta)meta;
    if(fireworkEffectMeta.hasEffect()) {
      hasEffect = true;
      colors = fireworkEffectMeta.getEffect().getColors();
      fadeColors = fireworkEffectMeta.getEffect().getFadeColors();
      type = fireworkEffectMeta.getEffect().getType().name();
      trail = fireworkEffectMeta.getEffect().hasTrail();
      flicker = fireworkEffectMeta.getEffect().hasFlicker();
    }
  }
  return this;
}
ItemMetaUtil.java 文件源码 项目:NPlugins 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Gets a String representing all special meta of this ItemStack, if any.
 *
 * @param is         the ItemStack
 * @param separators the separators
 *
 * @return a String representing this ItemStack's special meta or an empty String
 *
 * @throws InventoryUtilException if something goes wrong
 */
public static String getSpecialMetaString(final ItemStack is, final String[] separators) throws InventoryUtilException {
    final ItemMeta meta = is.getItemMeta();

    if (meta instanceof BookMeta) {
        return getBookMetaString((BookMeta)meta);
    } else if (meta instanceof EnchantmentStorageMeta) {
        return getEnchantmentStorageMetaString((EnchantmentStorageMeta)meta, separators);
    } else if (meta instanceof FireworkEffectMeta) {
        return getFireworkEffectMetaString((FireworkEffectMeta)meta);
    } else if (meta instanceof FireworkMeta) {
        return getFireworkMetaString((FireworkMeta)meta, separators);
    } else if (meta instanceof LeatherArmorMeta) {
        return getLeatherArmorMetaString((LeatherArmorMeta)meta);
    } else if (meta instanceof MapMeta) {
        return getMapMetaString((MapMeta)meta);
    } else if (meta instanceof PotionMeta) {
        return getPotionMetaString((PotionMeta)meta, separators);
    } else if (meta instanceof SkullMeta) {
        return getSkullMetaString((SkullMeta)meta);
    } else {
        throw new InventoryUtilException("Unknown Meta type '" + meta.getClass().getName() + "', please report this to the author (Ribesg)!");
    }
}
FireworkEffectsMeta.java 文件源码 项目:SaveableSerializing 阅读 26 收藏 0 点赞 0 评论 0
@Override
public void setTo(ItemMeta meta) {
    if(meta instanceof FireworkEffectMeta){
        FireworkEffectMeta fire = (FireworkEffectMeta) meta;
        FireworkEffect ef = (FireworkEffect) me.getOriginal();
        if(ef != null)
             fire.setEffect(ef);
    }
}
FireworkEffectsMeta.java 文件源码 项目:SaveableSerializing 阅读 22 收藏 0 点赞 0 评论 0
@Override
public SubMeta setFrom(ItemMeta meta) {
    if(meta instanceof FireworkEffectMeta){
        FireworkEffectMeta fire = (FireworkEffectMeta) meta;
        me = new FireworkEffects(fire.getEffect());
    }
    return this;
}
FireworkEffectsMeta.java 文件源码 项目:SaveableSerializing 阅读 21 收藏 0 点赞 0 评论 0
@Override
public void setTo(ItemMeta meta) {
    if(meta instanceof FireworkEffectMeta){
        FireworkEffectMeta fire = (FireworkEffectMeta) meta;
        FireworkEffect ef = (FireworkEffect) me.getOriginal();
        if(ef != null)
             fire.setEffect(ef);
    }
}
FireworkEffectsMeta.java 文件源码 项目:SaveableSerializing 阅读 29 收藏 0 点赞 0 评论 0
@Override
public SubMeta setFrom(ItemMeta meta) {
    if(meta instanceof FireworkEffectMeta){
        FireworkEffectMeta fire = (FireworkEffectMeta) meta;
        me = new FireworkEffects(fire.getEffect());
    }
    return this;
}
ItemBuilder.java 文件源码 项目:SupaCommons 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Adds {@link FireworkEffect}s to this item, assuming it is a firework or firework charge.
 * <p />
 * <b>UNSAFE</b>
 *
 * @param effects effects to add
 *
 * @return this item builder instance, for chaining
 */
public ItemBuilder fireworkAdd(@Nonnull FireworkEffect... effects) {
  if (effects == null) {
    if (!this.failSilently) {
      throw new IllegalArgumentException("effects cannot be null.");
    }
    return this;
  }
  boolean b = false;
  try {
    b = isFireworkEffectMeta();
  } catch (IllegalStateException ignored) {
  }
  if (b || isFireworkMeta()) {
    try {
      if (b) {
        ((FireworkEffectMeta) this.itemMeta).setEffect(effects[0]);
      } else {
        ((FireworkMeta) this.itemMeta).addEffects(effects);
      }
    } catch (Exception e) {
      if (!this.failSilently) {
        e.printStackTrace();
      }
    }
  }
  return this;
}
ItemBuilder.java 文件源码 项目:SupaCommons 阅读 21 收藏 0 点赞 0 评论 0
private boolean isFireworkEffectMeta() {
  if (!(this.itemMeta instanceof FireworkEffectMeta)) {
    if (!this.failSilently) {
      throw new IllegalStateException("ItemMeta is not of FireworkEffectMeta.");
    }
    return false;
  }
  return true;
}
CardboardMetaFireworkEffect.java 文件源码 项目:StarQuestCode 阅读 27 收藏 0 点赞 0 评论 0
@SuppressWarnings("deprecation")
public CardboardMetaFireworkEffect(ItemStack firework) {

    this.id = firework.getTypeId();
    FireworkEffectMeta meta = (FireworkEffectMeta) firework.getItemMeta();
    this.effect = new CardboardFireworkEffect(meta.getEffect());
}
CardboardMetaFireworkEffect.java 文件源码 项目:StarQuestCode 阅读 21 收藏 0 点赞 0 评论 0
@SuppressWarnings("deprecation")
public ItemMeta unbox() {

    FireworkEffectMeta meta = (FireworkEffectMeta) new ItemStack(this.id).getItemMeta();
    meta.setEffect(this.effect.unbox());
    return meta;
}
CardboardMetaFireworkEffect.java 文件源码 项目:StarQuestCode 阅读 18 收藏 0 点赞 0 评论 0
@SuppressWarnings("deprecation")
public CardboardMetaFireworkEffect(ItemStack firework) {

    this.id = firework.getTypeId();
    FireworkEffectMeta meta = (FireworkEffectMeta) firework.getItemMeta();
    this.effect = new CardboardFireworkEffect(meta.getEffect());
}
CardboardMetaFireworkEffect.java 文件源码 项目:StarQuestCode 阅读 18 收藏 0 点赞 0 评论 0
@SuppressWarnings("deprecation")
public ItemMeta unbox() {

    FireworkEffectMeta meta = (FireworkEffectMeta) new ItemStack(this.id).getItemMeta();
    meta.setEffect(this.effect.unbox());
    return meta;
}
FireworkEffectData.java 文件源码 项目:TNE-Bukkit 阅读 17 收藏 0 点赞 0 评论 0
@Override
public ItemStack build(ItemStack stack) {
  if(valid && hasEffect) {
    FireworkEffectMeta meta = (FireworkEffectMeta)stack.getItemMeta();
    FireworkEffect effect = FireworkEffect.builder().flicker(flicker)
                            .trail(trail).withColor(colors).withFade(fadeColors)
                            .with(FireworkEffect.Type.valueOf(type)).build();
    meta.setEffect(effect);
    stack.setItemMeta(meta);
  }
  return stack;
}
ItemMetaUtil.java 文件源码 项目:NPlugins 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Parses 3 strings into an ItemMeta.
 *
 * @param meta              the ItemMeta to complete
 * @param nameString        the DisplayName String
 * @param loreString        the Lore String representation
 * @param specialMetaString the Special Meta part String representation
 *
 * @return the same ItemMeta, completed
 */
public static ItemMeta fromString(final ItemMeta meta, final String nameString, final String loreString, final String specialMetaString, final String[] separators) throws InventoryUtilException {
    if (meta instanceof BookMeta) {
        parseBookMetaString(specialMetaString, (BookMeta)meta);
    } else if (meta instanceof EnchantmentStorageMeta) {
        parseEnchantmentStorageMetaString(specialMetaString, (EnchantmentStorageMeta)meta, separators);
    } else if (meta instanceof FireworkEffectMeta) {
        parseFireworkEffectMetaString(specialMetaString, (FireworkEffectMeta)meta);
    } else if (meta instanceof FireworkMeta) {
        parseFireworkMetaString(specialMetaString, (FireworkMeta)meta, separators);
    } else if (meta instanceof LeatherArmorMeta) {
        parseLeatherArmorMetaString(specialMetaString, (LeatherArmorMeta)meta);
    } else if (meta instanceof MapMeta) {
        parseMapMetaString(specialMetaString, (MapMeta)meta);
    } else if (meta instanceof PotionMeta) {
        parsePotionMetaString(specialMetaString, (PotionMeta)meta, separators);
    } else if (meta instanceof SkullMeta) {
        parseSkullMetaString(specialMetaString, (SkullMeta)meta);
    }

    if (!nameString.isEmpty()) {
        meta.setDisplayName(nameString);
    }

    if (loreString.length() > 1) {
        final List<String> lore = new ArrayList<>();
        final String separator = loreString.substring(0, 2);
        Collections.addAll(lore, StringUtil.splitKeepEmpty(loreString.substring(2), separator));
        meta.setLore(lore);
    }

    return meta;
}
ItemMetaUtil.java 文件源码 项目:NPlugins 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Saves an ItemMeta to a ConfigurationSection
 *
 * @param itemSection the parent section of the to-be-created meta section
 * @param is          the ItemStack
 */
public static void saveToConfigSection(final ConfigurationSection itemSection, final ItemStack is) {
    final ItemMeta meta = is.getItemMeta();

    if (meta instanceof BookMeta) {
        saveBookMetaToConfigSection(createAndGetSection(itemSection, "meta"), (BookMeta)meta);
    } else if (meta instanceof EnchantmentStorageMeta) {
        saveEnchantmentStorageMetaToConfigSection(createAndGetSection(itemSection, "meta"), (EnchantmentStorageMeta)meta);
    } else if (meta instanceof FireworkEffectMeta) {
        saveFireworkEffectMetaToConfigSection(createAndGetSection(itemSection, "meta"), (FireworkEffectMeta)meta);
    } else if (meta instanceof FireworkMeta) {
        saveFireworkMetaToConfigSection(createAndGetSection(itemSection, "meta"), (FireworkMeta)meta);
    } else if (meta instanceof LeatherArmorMeta) {
        saveLeatherArmorMetaToConfigSection(createAndGetSection(itemSection, "meta"), (LeatherArmorMeta)meta);
    } else if (meta instanceof MapMeta) {
        saveMapMetaToConfigSection(createAndGetSection(itemSection, "meta"), (MapMeta)meta);
    } else if (meta instanceof PotionMeta) {
        savePotionMetaToConfigSection(createAndGetSection(itemSection, "meta"), (PotionMeta)meta);
    } else if (meta instanceof SkullMeta) {
        saveSkullMetaToConfigSection(createAndGetSection(itemSection, "meta"), (SkullMeta)meta);
    }

    if (meta.hasDisplayName()) {
        createAndGetSection(itemSection, "meta").set("name", ColorUtil.decolorize(meta.getDisplayName()));
    }

    if (meta.hasLore()) {
        createAndGetSection(itemSection, "meta").set("lore", ColorUtil.decolorize(meta.getLore()));
    }
}
ItemMetaUtil.java 文件源码 项目:NPlugins 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Loads an ItemMeta from a ConfigurationSection.
 *
 * @param itemSection the parent section of the meta section
 * @param is          the ItemStack to complete
 *
 * @throws InventoryUtilException if something goes wrong
 */
public static void loadFromConfigSection(final ConfigurationSection itemSection, final ItemStack is) throws InventoryUtilException {
    if (itemSection.isConfigurationSection("meta")) {
        final ItemMeta meta = is.getItemMeta();
        final ConfigurationSection metaSection = itemSection.getConfigurationSection("meta");

        if (meta instanceof BookMeta) {
            loadBookMetaFromConfigSection(metaSection, (BookMeta)meta);
        } else if (meta instanceof EnchantmentStorageMeta) {
            loadEnchantmentStorageMetaFromConfigSection(metaSection, (EnchantmentStorageMeta)meta);
        } else if (meta instanceof FireworkEffectMeta) {
            loadFireworkEffectMetaFromConfigSection(metaSection, (FireworkEffectMeta)meta);
        } else if (meta instanceof FireworkMeta) {
            loadFireworkMetaFromConfigSection(metaSection, (FireworkMeta)meta);
        } else if (meta instanceof LeatherArmorMeta) {
            loadLeatherArmorMetaFromConfigSection(metaSection, (LeatherArmorMeta)meta);
        } else if (meta instanceof MapMeta) {
            loadMapMetaFromConfigSection(metaSection, (MapMeta)meta);
        } else if (meta instanceof PotionMeta) {
            loadPotionMetaFromConfigSection(metaSection, (PotionMeta)meta);
        } else if (meta instanceof SkullMeta) {
            loadSkullMetaFromConfigSection(metaSection, (SkullMeta)meta);
        }

        final String displayName = metaSection.getString("name", "");
        if (!displayName.isEmpty()) {
            meta.setDisplayName(ColorUtil.colorize(displayName));
        }

        final List<String> lore = metaSection.getStringList("lore");
        if (!lore.isEmpty()) {
            meta.setLore(ColorUtil.colorize(lore));
        }

        is.setItemMeta(meta);
    }
}
ExchangeRule.java 文件源码 项目:ItemExchange 阅读 21 收藏 0 点赞 0 评论 0
public static ExchangeRule parseItemStack(ItemStack itemStack, RuleType ruleType) throws ExchangeRuleCreateException {
    Map<Enchantment, Integer> requiredEnchantments = new HashMap<Enchantment, Integer>();
    for (Enchantment enchantment : itemStack.getEnchantments().keySet()) {
        requiredEnchantments.put(enchantment, itemStack.getEnchantments().get(enchantment));
    }
    String displayName = "";
    String[] lore = new String[0];
    AdditionalMetadata additional = null;
    if (itemStack.hasItemMeta()) {
        ItemMeta itemMeta = itemStack.getItemMeta();
        if (itemMeta.hasDisplayName()) {
            displayName = itemMeta.getDisplayName();
        }
        if (itemMeta.hasLore()) {
            lore = itemMeta.getLore().toArray(new String[itemMeta.getLore().size()]);
        }

        if(itemMeta instanceof BookMeta) {
            additional = new BookMetadata((BookMeta) itemMeta);
        }
        else if(itemMeta instanceof EnchantmentStorageMeta) {
            additional = new EnchantmentStorageMetadata((EnchantmentStorageMeta) itemMeta);
        }
        else if(itemMeta instanceof PotionMeta) {
            additional = new PotionMetadata((PotionMeta) itemMeta);
        }
        //I've removed the PotionMeta block since it is not required if only vanilla potions are used, PotionMeta support should be added in the future
        if(itemMeta instanceof FireworkEffectMeta || itemMeta instanceof FireworkMeta || itemMeta instanceof LeatherArmorMeta || itemMeta instanceof MapMeta || itemMeta instanceof SkullMeta) {
            throw new ExchangeRuleCreateException("This item is not yet supported by ItemExchange.");
        }
    }

    ExchangeRule exchangeRule = new ExchangeRule(itemStack.getType(), itemStack.getAmount(), itemStack.getDurability(), requiredEnchantments, new ArrayList<Enchantment>(), false, displayName, lore, ruleType);

    exchangeRule.setAdditionalMetadata(additional);

    return exchangeRule;
}
FireworkChargeCustomItem.java 文件源码 项目:uppercore 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void processMeta(Player player, ItemMeta m) {
    super.processMeta(player, m);
    FireworkEffectMeta meta = (FireworkEffectMeta) m;
    meta.setEffect(effect);
}
FireworkEffectMetaStorage.java 文件源码 项目:Leveled-Storage 阅读 23 收藏 0 点赞 0 评论 0
public FireworkEffectMetaStorage(FireworkEffectMeta meta) {
    super(meta);
}
XMLItemMeta.java 文件源码 项目:Arcade2 阅读 21 收藏 0 点赞 0 评论 0
public static FireworkEffectMeta parseFireworkEffect(Element xml, FireworkEffectMeta source) {
    return source;
}
TestItemFactory.java 文件源码 项目:ExilePearl 阅读 18 收藏 0 点赞 0 评论 0
private ItemMeta getItemMetaIntenal(Material material) {
      switch (material) {
      case AIR:
          return null;
      case WRITTEN_BOOK:
      case BOOK_AND_QUILL:
        return mock(BookMeta.class);
      case SKULL_ITEM:
        return mock(SkullMeta.class);
      case LEATHER_HELMET:
      case LEATHER_CHESTPLATE:
      case LEATHER_LEGGINGS:
      case LEATHER_BOOTS:
        return mock(LeatherArmorMeta.class);
      case POTION:
      case SPLASH_POTION:
      case LINGERING_POTION:
      case TIPPED_ARROW:
        return mock(PotionMeta.class);
      case MAP:
        return mock(PotionMeta.class);
      case FIREWORK:
        return mock(PotionMeta.class);
      case FIREWORK_CHARGE:
        return mock(FireworkEffectMeta.class);
      case ENCHANTED_BOOK:
        return mock(EnchantmentStorageMeta.class);
      case BANNER:
        return mock(BannerMeta.class);
      case FURNACE:
      case CHEST:
      case TRAPPED_CHEST:
      case JUKEBOX:
      case DISPENSER:
      case DROPPER:
      case SIGN:
      case MOB_SPAWNER:
      case NOTE_BLOCK:
      case PISTON_BASE:
      case BREWING_STAND_ITEM:
      case ENCHANTMENT_TABLE:
      case COMMAND:
      case COMMAND_REPEATING:
      case COMMAND_CHAIN:
      case BEACON:
      case DAYLIGHT_DETECTOR:
      case DAYLIGHT_DETECTOR_INVERTED:
      case HOPPER:
      case REDSTONE_COMPARATOR:
      case FLOWER_POT_ITEM:
      case SHIELD:
      case STRUCTURE_BLOCK:
return mock(BlockStateMeta.class);
      default:
        return mock(ItemMeta.class);
      }
  }
CardboardMetaFireworkEffect.java 文件源码 项目:StarQuestCode 阅读 18 收藏 0 点赞 0 评论 0
public CardboardMetaFireworkEffect(ItemStack firework) {

        this.id = firework.getTypeId();
        FireworkEffectMeta meta = (FireworkEffectMeta) firework.getItemMeta();
        this.effect = new CardboardFireworkEffect(meta.getEffect());
    }
CardboardMetaFireworkEffect.java 文件源码 项目:StarQuestCode 阅读 18 收藏 0 点赞 0 评论 0
public ItemMeta unbox() {

        FireworkEffectMeta meta = (FireworkEffectMeta) new ItemStack(this.id).getItemMeta();
        meta.setEffect(this.effect.unbox());
        return meta;
    }
Chat.java 文件源码 项目:NPlugins 阅读 15 收藏 0 点赞 0 评论 0
private static void appendItemTag(final StringBuilder builder, final ItemStack is) {
    boolean hasTag = false;
    final StringBuilder tagBuilder = new StringBuilder();

    // Enchantments
    final Map<Enchantment, Integer> enchantments = is.getEnchantments();
    if (enchantments != null && !enchantments.isEmpty()) {
        tagBuilder.append("ench:[");
        final Iterator<Entry<Enchantment, Integer>> it = enchantments.entrySet().iterator();
        while (it.hasNext()) {
            final Entry<Enchantment, Integer> entry = it.next();
            tagBuilder.append("{id:")
                      .append(entry.getKey().getId())
                      .append(",lvl:")
                      .append(entry.getValue());
            if (it.hasNext()) {
                tagBuilder.append(',');
            }
        }
        tagBuilder.append("],");
        hasTag = true;
    }

    // Meta
    if (is.hasItemMeta()) {
        final ItemMeta meta = is.getItemMeta();
        if (meta.hasDisplayName() || meta.hasLore() || Chat.isLeatherArmor(is)) {
            Chat.appendItemDisplay(tagBuilder, meta);
        }
        if (is.getType() == Material.POTION) {
            Chat.appendItemPotion(tagBuilder, (PotionMeta)meta);
        }
        if (is.getType() == Material.WRITTEN_BOOK) {
            Chat.appendItemBook(tagBuilder, (BookMeta)meta);
        }
        if (is.getType() == Material.SKULL_ITEM) {
            Chat.appendItemSkull(tagBuilder, (SkullMeta)meta);
        }
        if (is.getType() == Material.FIREWORK) { // Firework Rocket
            Chat.appendItemFirework(tagBuilder, (FireworkMeta)meta);
        }
        if (is.getType() == Material.FIREWORK_CHARGE) { // Firework Star
            Chat.appendItemFireworkEffect(tagBuilder, (FireworkEffectMeta)meta);
        }
    }

    if (hasTag && tagBuilder.charAt(builder.length() - 1) == ',') {
        tagBuilder.deleteCharAt(builder.length() - 1);
    }

    // Append to main builder
    if (hasTag) {
        builder.append(',').append("tag:{").append(tagBuilder).append('}');
    }
}
Chat.java 文件源码 项目:NPlugins 阅读 25 收藏 0 点赞 0 评论 0
private static void appendItemFireworkEffect(final StringBuilder builder, final FireworkEffectMeta meta) {
    // TODO
}
ItemMetaUtil.java 文件源码 项目:NPlugins 阅读 18 收藏 0 点赞 0 评论 0
private static String getFireworkEffectMetaString(final FireworkEffectMeta meta) {
    return getFireworkEffectString(meta.getEffect());
}


问题


面经


文章

微信
公众号

扫码关注公众号