当前位置: 首页>>代码示例>>Java>>正文


Java FireworkEffectMeta类代码示例

本文整理汇总了Java中org.bukkit.inventory.meta.FireworkEffectMeta的典型用法代码示例。如果您正苦于以下问题:Java FireworkEffectMeta类的具体用法?Java FireworkEffectMeta怎么用?Java FireworkEffectMeta使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FireworkEffectMeta类属于org.bukkit.inventory.meta包,在下文中一共展示了FireworkEffectMeta类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
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;
}
 
开发者ID:ShootGame,项目名称:Arcade2,代码行数:26,代码来源:XMLItemMeta.java

示例2: apply

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
@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;
}
 
开发者ID:SupaHam,项目名称:SupaCommons,代码行数:18,代码来源:ItemMatcher.java

示例3: fireworkRemove

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SupaHam,项目名称:SupaCommons,代码行数:29,代码来源:ItemBuilder.java

示例4: fireworkClear

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SupaHam,项目名称:SupaCommons,代码行数:25,代码来源:ItemBuilder.java

示例5: initialize

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
@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;
}
 
开发者ID:TheNewEconomy,项目名称:TNE-Bukkit,代码行数:18,代码来源:FireworkEffectData.java

示例6: getSpecialMetaString

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
/**
 * 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)!");
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:34,代码来源:ItemMetaUtil.java

示例7: setTo

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:DevCrafters,项目名称:SaveableSerializing,代码行数:10,代码来源:FireworkEffectsMeta.java

示例8: setFrom

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
@Override
public SubMeta setFrom(ItemMeta meta) {
    if(meta instanceof FireworkEffectMeta){
        FireworkEffectMeta fire = (FireworkEffectMeta) meta;
        me = new FireworkEffects(fire.getEffect());
    }
    return this;
}
 
开发者ID:DevCrafters,项目名称:SaveableSerializing,代码行数:9,代码来源:FireworkEffectsMeta.java

示例9: fireworkAdd

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SupaHam,项目名称:SupaCommons,代码行数:37,代码来源:ItemBuilder.java

示例10: isFireworkEffectMeta

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
private boolean isFireworkEffectMeta() {
  if (!(this.itemMeta instanceof FireworkEffectMeta)) {
    if (!this.failSilently) {
      throw new IllegalStateException("ItemMeta is not of FireworkEffectMeta.");
    }
    return false;
  }
  return true;
}
 
开发者ID:SupaHam,项目名称:SupaCommons,代码行数:10,代码来源:ItemBuilder.java

示例11: CardboardMetaFireworkEffect

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public CardboardMetaFireworkEffect(ItemStack firework) {

	this.id = firework.getTypeId();
	FireworkEffectMeta meta = (FireworkEffectMeta) firework.getItemMeta();
	this.effect = new CardboardFireworkEffect(meta.getEffect());
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:8,代码来源:CardboardMetaFireworkEffect.java

示例12: unbox

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public ItemMeta unbox() {

	FireworkEffectMeta meta = (FireworkEffectMeta) new ItemStack(this.id).getItemMeta();
	meta.setEffect(this.effect.unbox());
	return meta;
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:8,代码来源:CardboardMetaFireworkEffect.java

示例13: build

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
@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;
}
 
开发者ID:TheNewEconomy,项目名称:TNE-Bukkit,代码行数:13,代码来源:FireworkEffectData.java

示例14: fromString

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:43,代码来源:ItemMetaUtil.java

示例15: saveToConfigSection

import org.bukkit.inventory.meta.FireworkEffectMeta; //导入依赖的package包/类
/**
 * 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()));
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:36,代码来源:ItemMetaUtil.java


注:本文中的org.bukkit.inventory.meta.FireworkEffectMeta类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。