本文整理汇总了Java中org.bukkit.Material.SHIELD属性的典型用法代码示例。如果您正苦于以下问题:Java Material.SHIELD属性的具体用法?Java Material.SHIELD怎么用?Java Material.SHIELD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.SHIELD属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: change
@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
ItemStack i = item.getSingle(e);
if (i == null) {
return;
}
if (i.getType() == Material.BANNER || i.getType() == Material.SHIELD) {
BannerMeta meta = ((BannerMeta) i.getItemMeta());
switch (mode) {
case ADD:
Arrays.asList(((Pattern[]) delta)).forEach(meta::addPattern);
break;
case SET:
meta.setPatterns(Arrays.asList(((Pattern[]) delta)));
break;
case DELETE:
case RESET:
for (int j = 1; j <= meta.numberOfPatterns(); j++) {
meta.removePattern(j);
}
break;
}
i.setItemMeta(meta);
}
}
示例2: change
@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
ItemStack i = item.getSingle(e);
if (i == null) {
return;
}
if (i.getType() == Material.BANNER || i.getType() == Material.SHIELD) {
BannerMeta meta = ((BannerMeta) i.getItemMeta());
switch (mode) {
case SET:
Color c = (Color) delta[0];
meta.setBaseColor(c.getWoolColor());
break;
case RESET:
meta.setBaseColor(DyeColor.WHITE);
break;
}
i.setItemMeta(meta);
}
}
示例3: getRepresentation
/**
* {@inheritDoc}
*/
@Override
public default ItemStack getRepresentation() {
ItemStack stack = new ItemStack(Material.SHIELD);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(ChatColor.GRAY + "Shield Decoration");
stack.setItemMeta(meta);
return stack;
}
示例4: armorEnchantGUI
public static void armorEnchantGUI(Player player){
armorGUI = Bukkit.createInventory(null, 9, ChatColor.DARK_GRAY + "Armor Enchantments");
ItemStack filler = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 7);
ItemMeta fillerMeta = filler.getItemMeta();
fillerMeta.setDisplayName(ChatColor.GRAY + "");
filler.setItemMeta(fillerMeta);
ItemStack back = new ItemStack(Material.ARROW);
ItemMeta backMeta = back.getItemMeta();
backMeta.setDisplayName(ChatColor.RED + "Previous");
back.setItemMeta(backMeta);
ItemStack lifeEssence = new ItemStack(Material.POTION);
ItemMeta lifeEssenceMeta = lifeEssence.getItemMeta();
lifeEssenceMeta.setDisplayName(ChatColor.RED + "Life Essence");
lifeEssenceMeta.setLore(Arrays.asList(ChatColor.GRAY + Main.getEnchantment("Life Essence").getDescription(), ChatColor.GRAY + "Rarity: " + Main.getEnchantment("Life Essence").getRarity().getName()));
lifeEssence.setItemMeta(lifeEssenceMeta);
ItemStack endurance = new ItemStack(Material.SHIELD);
ItemMeta enduranceMeta = endurance.getItemMeta();
enduranceMeta.setDisplayName(ChatColor.GOLD + "Endurance");
enduranceMeta.setLore(Arrays.asList(ChatColor.GRAY + Main.getEnchantment("Endurance").getDescription(), ChatColor.GRAY + "Rarity: " + Main.getEnchantment("Endurance").getRarity().getName()));
endurance.setItemMeta(enduranceMeta);
armorGUI.setItem(0, filler);
armorGUI.setItem(1, filler);
armorGUI.setItem(2, filler);
armorGUI.setItem(3, lifeEssence);
armorGUI.setItem(4, filler);
armorGUI.setItem(5, endurance);
armorGUI.setItem(6, filler);
armorGUI.setItem(7, filler);
armorGUI.setItem(8, back);
player.openInventory(armorGUI);
}
示例5: setBanner
/**
* @param banner
* the banner to set
*/
public void setBanner(ItemStack banner) {
if (banner.getType() != Material.BANNER && banner.getType() != Material.SHIELD) {
return;
}
this.banner = (BannerMeta) banner.getItemMeta();
bannerColor = banner.getDurability();
}
示例6: get
@Nullable
@Override
protected Pattern[] get(Event e) {
ItemStack i = item.getSingle(e);
if (i == null) {
return null;
}
if (i.getType() == Material.BANNER || i.getType() == Material.SHIELD) {
return ((BannerMeta) i.getItemMeta()).getPatterns().stream().toArray(Pattern[]::new);
}
return null;
}
示例7: init
@Override
public boolean init(Expression<?>[] expr, int i, Kleenean kleenean, @NotNull SkriptParser.ParseResult parseResult) {
mat = parseResult.mark == 0 ? Material.BANNER : Material.SHIELD;
patterns = (Expression<Pattern>) expr[0];
color = (Expression<Color>) expr[1];
return true;
}
示例8: get
@Nullable
@Override
protected String[] get(Event e) {
ItemStack i = item.getSingle(e);
if (i == null) {
return null;
}
if (i.getType() == Material.BANNER || i.getType() == Material.SHIELD) {
return new String[]{BannerUtils.toMncPattern((BannerMeta) i.getItemMeta())};
}
return null;
}
示例9: execute
@Override
protected void execute(Event e) {
ItemStack i = item.getSingle(e);
Block b = block.getSingle(e);
if (i == null || b == null) {
return;
}
if ((i.getType() == Material.BANNER || i.getType() == Material.SHIELD) && b.getType() == Material.BANNER) {
BannerMeta itemMeta = ((BannerMeta) i.getItemMeta());
Banner blockMeta = ((Banner) b.getState());
blockMeta.setPatterns(itemMeta.getPatterns());
blockMeta.setBaseColor(itemMeta.getBaseColor());
blockMeta.update(true, false);
}
}
示例10: init
@Override
public boolean init(Expression<?>[] expr, int i, Kleenean kleenean, @NotNull SkriptParser.ParseResult parseResult) {
material = (parseResult.mark == 0) ? Material.BANNER : Material.SHIELD;
mncCode = (Expression<String>) expr[0];
return true;
}
示例11: init
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, @NotNull SkriptParser.ParseResult parseResult) {
type = parseResult.mark == 0 ? Material.BANNER : Material.SHIELD;
return true;
}