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


Java Material.GOLD_AXE属性代码示例

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


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

示例1: onDamage

@EventHandler
public void onDamage(EntityDamageByEntityEvent event) {
    if ((event.getDamager() instanceof Player)) {
        Player player = (Player) event.getDamager();
        if (player.getInventory().getItemInMainHand().getType() == Material.DIAMOND_AXE) {
            event.setDamage(event.getDamage() - 6.0D + 3.0D);
        } else if (player.getInventory().getItemInMainHand().getType() == Material.IRON_AXE) {
            event.setDamage(event.getDamage() - 6.0D + 2.5D);
        } else if (player.getInventory().getItemInMainHand().getType() == Material.STONE_AXE) {
            event.setDamage(event.getDamage() - 6.0D + 2.0D);
        } else if ((player.getInventory().getItemInMainHand().getType() == Material.GOLD_AXE) ||
                (player.getInventory().getItemInMainHand().getType() == Material.WOOD_AXE)) {
            event.setDamage(event.getDamage() - 4.0D + 1.5D);
        } else if (player.getInventory().getItemInMainHand().getType() == Material.DIAMOND_SPADE) {
            event.setDamage(event.getDamage() - 2.5D + 2.0D);
        } else if (player.getInventory().getItemInMainHand().getType() == Material.STONE_SPADE) {
            event.setDamage(event.getDamage() - 0.75D + 1.25D);
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:20,代码来源:LegacyDamageModule.java

示例2: onWoodBreak

@EventHandler
public void onWoodBreak(BlockBreakEvent event) {
    final Block b = event.getBlock();
    if (b != null && (b.getType() == Material.LOG || b.getType() == Material.LOG_2)) {
        Material handType = event.getPlayer().getItemInHand().getType();
        if (handType == Material.WOOD_AXE || handType == Material.STONE_AXE || handType == Material.IRON_AXE || handType == Material.GOLD_AXE || handType == Material.DIAMOND_AXE) {
            dataMap.put(b, b.getData());
            b.setType(Material.WOOL);
            b.setData(DyeColor.BLACK.getWoolData());
            Player p = event.getPlayer();
            event.getPlayer().sendMessage("> +1 Woodcutting EXP");
            Location loc = b.getLocation();
            Vector v = p.getLocation().subtract(loc).toVector().normalize().multiply(0.5);
            DropManager.dropItem(new ItemStack(Material.LOG), loc, event.getPlayer().getUniqueId()).setVelocity(v);
            RScheduler.schedule(plugin, () -> {
                b.setType(Material.LOG);
                b.setData(dataMap.getOrDefault(b, (byte) 0));
            }, RTicks.seconds(2));
        }
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:21,代码来源:SkillManager.java

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

		Random rand = new Random();
		
		if(mainItem.getType() == Material.GOLD_AXE)
		{
			enemy.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 480, 2, false));
			enemy.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 480, 0, false));
           	enemy.getLocation().getWorld().playSound(enemy.getLocation(), Sound.ENTITY_WITHER_SPAWN, 1.0F, rand.nextFloat() * 0.4F + 0.8F);
		}
	}
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:20,代码来源:StarBattleaxeWither.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: onItemClick

@SuppressWarnings("deprecation")
@EventHandler
public void onItemClick(PlayerInteractEvent event)
{
	Player player = event.getPlayer();
	ItemStack mainItem = player.getInventory().getItemInMainHand();
	
	Score score_dualWieldMsg = tech_dualWieldMsg.getScore(player);
	
	if(mainItem.getType() == Material.GOLD_AXE)
	{
		if(dualWield.getScore(player).getScore() == 0)
		{
			if(event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_AIR)
			{
				if(spin.getScore(player).getScore() == 0)
				{
					if(player.getFoodLevel() > 6)
					{
						Random rand = new Random();
						
						Spin(player);
						
						if(player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE)
							player.setFoodLevel(player.getFoodLevel() - 1);
						
						int chance_reduceDur = rand.nextInt(10) + 1;
						switch(chance_reduceDur)
						{
							case 1:
								mainItem.setDurability((short)(mainItem.getDurability() + 1));
								break;
							default:
						}
						
						if(mainItem.getDurability() >= 32)
						{
							player.getLocation().getWorld().playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, rand.nextFloat() * 0.4F + 0.8F);
							player.getInventory().setItemInMainHand(null);
						}
						player.updateInventory();
					}
					else
					{
						player.sendMessage(ChatColor.RED + Survival.Words.get("Lack of energy, unable to spin"));
					}
				}
			}
		}
		else 
		{
			if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
				score_dualWieldMsg.setScore(score_dualWieldMsg.getScore() + 1);
			else if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
				score_dualWieldMsg.setScore(score_dualWieldMsg.getScore() + 2);
			if(score_dualWieldMsg.getScore() == 2)
			{
				player.sendMessage(ChatColor.RED + Survival.Words.get("Unable to dual-wield with Valkyrie's Axe"));
			}
		}
	}
	score_dualWieldMsg.setScore(0);
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:63,代码来源:Valkyrie.java

示例6: onAttack

@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST)
public void onAttack(EntityDamageByEntityEvent event)
{
	if(event.isCancelled()) return;
	if(event.getDamager() instanceof Player)
	{
		Player player = (Player)event.getDamager();
		ItemStack mainItem = player.getInventory().getItemInMainHand();
		
		if(dualWield.getScore(player).getScore() == 0)
		{
			if(mainItem.getType() == Material.GOLD_AXE)
			{
				if(spin.getScore(player).getScore() == 0)
				{
					if(player.getFoodLevel() > 6)
					{
						Random rand = new Random();
						
						Spin(player);
						
						if(player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE)
							player.setFoodLevel(player.getFoodLevel() - 1);
						
						int chance_reduceDur = rand.nextInt(10) + 1;
						switch(chance_reduceDur)
						{
							case 1:
								mainItem.setDurability((short)(mainItem.getDurability() + 1));
								break;
							default:
						}
						
						if(mainItem.getDurability() >= 32)
						{
							player.getLocation().getWorld().playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, rand.nextFloat() * 0.4F + 0.8F);
							player.getInventory().setItemInMainHand(null);
						}
						player.updateInventory();
					}
					else
					{
						player.sendMessage(ChatColor.RED + Survival.Words.get("Lack of energy, unable to spin"));
					}
				}
			}
		}
		else
		{
			event.setCancelled(true);
			return;
		}
	}
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:55,代码来源:Valkyrie.java

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

示例8: clearJunk

public void clearJunk(){
	World world = Bukkit.getWorld("kaospvp");
	List<Entity> list = world.getEntities();
	for(Entity e : list){
		if(e instanceof Item){
			Item it = (Item) e;
			if( it.getItemStack().getType() == Material.POTION &&
				it.getItemStack().getDurability() == 16453){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.GOLDEN_APPLE &&
				it.getItemStack().getDurability() == 0){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.ARROW){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.GLASS_BOTTLE){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.DIAMOND_BOOTS &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.DIAMOND_LEGGINGS &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.DIAMOND_CHESTPLATE &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.DIAMOND_HELMET &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.DIAMOND_SWORD &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();	
			}
			if( it.getItemStack().getType() == Material.BOW &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();	
			}
			if( it.getItemStack().getType() == Material.WOOD_AXE ||
				it.getItemStack().getType() == Material.STONE_AXE ||
				it.getItemStack().getType() == Material.GOLD_AXE ||
				it.getItemStack().getType() == Material.IRON_AXE ||
				it.getItemStack().getType() == Material.DIAMOND_AXE){
				e.remove();
			}
		}
	}
}
 
开发者ID:OverloadedCore,项目名称:kaosEssentials,代码行数:54,代码来源:Core.java


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