FireworkUtil.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:ProjectAres 作者:
public static @Nonnull Firework spawnFirework(@Nonnull Location location, @Nonnull FireworkEffect effect, int power) {
    Preconditions.checkNotNull(location, "location");
    Preconditions.checkNotNull(effect, "firework effect");
    Preconditions.checkArgument(power >= 0, "power must be positive");

    FireworkMeta meta = (FireworkMeta) Bukkit.getItemFactory().getItemMeta(Material.FIREWORK);
    meta.setPower(power);
    meta.addEffect(effect);

    Firework firework = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
    firework.setFireworkMeta(meta);

    return firework;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号