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


Java Material.WOOD_SWORD屬性代碼示例

本文整理匯總了Java中org.bukkit.Material.WOOD_SWORD屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.WOOD_SWORD屬性的具體用法?Java Material.WOOD_SWORD怎麽用?Java Material.WOOD_SWORD使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.bukkit.Material的用法示例。


在下文中一共展示了Material.WOOD_SWORD屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: register

public void register() {
    ItemStack selector = new ItemStack(Material.WOOD_SWORD);
    ItemMeta im = selector.getItemMeta();
    im.setDisplayName("§a木劍");
    selector.setItemMeta(im);
    this.setSelector(selector);

    ItemStack show = new ItemStack(Material.WOOD_SWORD);
    im = show.getItemMeta();
    im.setDisplayName("§a木劍");
    im.spigot().setUnbreakable(true);
    show.setItemMeta(im);
    this.setShow(show);
    this.setSkillType(SkillType.ITEM);
    SkillManager.getInstance().register(this);
    Bukkit.getPluginManager().registerEvents(this, Main.getInstance());
}
 
開發者ID:Soldier233,項目名稱:ArchersBattle,代碼行數:17,代碼來源:Sword.java

示例2: onCraftItem

private static void onCraftItem(Recipe recipe, CraftingInventory inventory)
{
    if (recipe.getResult().getType() == Material.WOOD_SWORD
            || recipe.getResult().getType() == Material.STONE_SWORD
            || recipe.getResult().getType() == Material.IRON_SWORD
            || recipe.getResult().getType() == Material.GOLD_SWORD
            || recipe.getResult().getType() == Material.DIAMOND_SWORD)
        inventory.setResult(new ItemStack(Material.AIR));
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:9,代碼來源:NoSwordModule.java

示例3: onCraftItem

private void onCraftItem(Recipe recipe, CraftingInventory inventory)
{
    if (recipe.getResult().getType() == Material.WOOD_SWORD)
        inventory.setResult(new ItemStack(this.getMaterial(Material.WOOD_SWORD)));
    else if (recipe.getResult().getType() == Material.WOOD_PICKAXE)
        inventory.setResult(new ItemStack(this.getMaterial(Material.WOOD_PICKAXE)));
    else if (recipe.getResult().getType() == Material.WOOD_AXE)
        inventory.setResult(new ItemStack(this.getMaterial(Material.WOOD_AXE)));
    else if (recipe.getResult().getType() == Material.WOOD_SPADE)
        inventory.setResult(new ItemStack(this.getMaterial(Material.WOOD_SPADE)));
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:11,代碼來源:RapidToolsModule.java

示例4: isTool

static boolean isTool(ItemStack item) {
    if (item == null) return false;
    final Material material = item.getType();
    // shears
    if (material == Material.SHEARS) return true;
    // wood tools
    if (material == Material.WOOD_SWORD || material == Material.WOOD_AXE || material == Material.WOOD_HOE || material == Material.WOOD_PICKAXE || material == Material.WOOD_SPADE) {
        return true;
    }
    // stone tools
    if (material == Material.STONE_SWORD || material == Material.STONE_AXE || material == Material.STONE_HOE || material == Material.STONE_PICKAXE || material == Material.STONE_SPADE) {
        return true;
    }
    // iron tools
    if (material == Material.IRON_SWORD || material == Material.IRON_AXE || material == Material.IRON_HOE || material == Material.IRON_PICKAXE || material == Material.IRON_SPADE) {
        return true;
    }
    // gold tools
    if (material == Material.GOLD_SWORD || material == Material.GOLD_AXE || material == Material.GOLD_HOE || material == Material.GOLD_PICKAXE || material == Material.GOLD_SPADE) {
        return true;
    }
    // diamond tools
    if (material == Material.DIAMOND_SWORD || material == Material.DIAMOND_AXE || material == Material.DIAMOND_HOE || material == Material.DIAMOND_PICKAXE || material == Material.DIAMOND_SPADE) {
        return true;
    }
    return false;
}
 
開發者ID:Recraft,項目名稱:Recreator,代碼行數:27,代碼來源:Item.java

示例5: onInventoryClick

@EventHandler
public void onInventoryClick(InventoryClickEvent e)
{
	Inventory inv = e.getInventory();
		 
	if(inv instanceof AnvilInventory)
	{
		AnvilInventory anvil = (AnvilInventory)inv;
		InventoryView view = e.getView();
		int rawSlot = e.getRawSlot();
		 
		// compare raw slot to the inventory view to make sure we are in the upper inventory
		if(rawSlot == view.convertSlot(rawSlot))
		{
			// 2 = result slot
			if(rawSlot == 2)
			{
				// item in the left slot
				ItemStack item = anvil.getContents()[0];
				
				if(item != null)
				{
					if
					(
						item.getType() == Material.GOLD_AXE
						|| item.getType() == Material.GOLD_PICKAXE
						|| item.getType() == Material.GOLD_SPADE
						|| item.getType() == Material.GOLD_HOE
						|| item.getType() == Material.GOLD_SWORD
						|| item.getType() == Material.WOOD_AXE
						|| item.getType() == Material.WOOD_PICKAXE
						|| item.getType() == Material.WOOD_SPADE
						|| item.getType() == Material.WOOD_HOE
						|| item.getType() == Material.WOOD_SWORD
					)
					{
						e.setCancelled(true);
						e.getWhoClicked().closeInventory();
						e.getWhoClicked().sendMessage(ChatColor.RED + Survival.Words.get("You cannot rename or repair ") + item.getItemMeta().getDisplayName() + ChatColor.RED + Survival.Words.get("period"));
					}
				}
			}
		}
	}
}
 
開發者ID:FattyMieo,項目名稱:SurvivalPlus,代碼行數:45,代碼來源:NoAnvil.java


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