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


Java Material.GOLD_SPADE属性代码示例

本文整理汇总了Java中org.bukkit.Material.GOLD_SPADE属性的典型用法代码示例。如果您正苦于以下问题:Java Material.GOLD_SPADE属性的具体用法?Java Material.GOLD_SPADE怎么用?Java Material.GOLD_SPADE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.Material的用法示例。


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

示例1: onAttack

@EventHandler(priority = EventPriority.HIGHEST)
public void onAttack(EntityDamageByEntityEvent event)
{
	if(event.isCancelled()) return;
	if(event.getDamager() instanceof Player && event.getEntity() instanceof LivingEntity && event.getCause() == DamageCause.ENTITY_ATTACK)
	{
		Player player = (Player)event.getDamager();
		ItemStack mainItem = player.getInventory().getItemInMainHand();
		LivingEntity enemy = (LivingEntity)event.getEntity();
		
		if(mainItem.getType() == Material.GOLD_SPADE)
		{
			enemy.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 100, 0, false));
			enemy.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100, 0, false));
			player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 48, 2, true));
			Location particleLoc = player.getLocation();
			particleLoc.setY(particleLoc.getY() + 2);
               ParticleEffect.HEART.display(0.5f, 0, 0.5f, 1, 2, particleLoc, 64);
		}
	}
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:21,代码来源:ObsidianMaceWeakness.java

示例2: Bazooka

public Bazooka(int id) {
    super(id, Material.GOLD_SPADE, "Bazooka", lore);

    setSound(Sound.BLOCK_ANVIL_BREAK);
    setAmmo(new Grenades());
    setShootCooldown(1750);
}
 
开发者ID:cadox8,项目名称:WC,代码行数:7,代码来源:Bazooka.java

示例3: 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

示例4: getProgressBar

public ItemStack getProgressBar()
{
    return new ItemStack(Material.GOLD_SPADE);
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:4,代码来源:ElectricDustWasher.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.GOLD_SPADE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。