當前位置: 首頁>>代碼示例>>Java>>正文


Java Material.SHIELD屬性代碼示例

本文整理匯總了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);
	}

}
 
開發者ID:Syst3ms,項目名稱:QuarSK,代碼行數:26,代碼來源:SExprItemLayers.java

示例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);
	}
}
 
開發者ID:Syst3ms,項目名稱:QuarSK,代碼行數:20,代碼來源:SExprItemBaseColor.java

示例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;
}
 
開發者ID:Jannyboy11,項目名稱:CustomRecipes,代碼行數:11,代碼來源:ShieldDecorationRecipe.java

示例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);
}
 
開發者ID:Warvale,項目名稱:Scorch,代碼行數:37,代碼來源:EnchantsCommand.java

示例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();
}
 
開發者ID:DRE2N,項目名稱:FactionsXL,代碼行數:12,代碼來源:LegalEntity.java

示例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;
}
 
開發者ID:Syst3ms,項目名稱:QuarSK,代碼行數:12,代碼來源:SExprItemLayers.java

示例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;
}
 
開發者ID:Syst3ms,項目名稱:QuarSK,代碼行數:7,代碼來源:ExprBannerOrShieldWithLayers.java

示例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;
}
 
開發者ID:Syst3ms,項目名稱:QuarSK,代碼行數:12,代碼來源:ExprBannerItemToMnc.java

示例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);
	}
}
 
開發者ID:Syst3ms,項目名稱:QuarSK,代碼行數:15,代碼來源:EffApplyBannerItemToBlock.java

示例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;
}
 
開發者ID:Syst3ms,項目名稱:QuarSK,代碼行數:6,代碼來源:ExprBannerItemFromMnc.java

示例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;
}
 
開發者ID:Syst3ms,項目名稱:QuarSK,代碼行數:5,代碼來源:ExprRandomBanner.java


注:本文中的org.bukkit.Material.SHIELD屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。