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


Java Material.GOLD_SWORD属性代码示例

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


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

示例1: onEntityDamageByEntity

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
    Entity entity = event.getEntity();
    Entity damager = event.getDamager();
    if (entity instanceof Player && damager instanceof Player) {
        Player attacker = (Player) damager;
        if (plugin.getPvpClassManager().getEquippedClass(attacker) == this) {
            ItemStack stack = attacker.getItemInHand();
            if (stack != null && stack.getType() == Material.GOLD_SWORD && stack.getEnchantments().isEmpty()) {
                Player player = (Player) entity;
                player.sendMessage(SettingsYML.ENEMY_COLOUR + attacker.getName() + ChatColor.YELLOW + " has backstabbed you.");
                player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1.0F, 1.0F);

                attacker.sendMessage(ChatColor.YELLOW + "You have backstabbed " + SettingsYML.ENEMY_COLOUR + player.getName() + ChatColor.YELLOW + '.');
                attacker.setItemInHand(new ItemStack(Material.AIR, 1));
                player.setHealth(12);
                attacker.playSound(player.getLocation(), Sound.ITEM_BREAK, 1.0F, 1.0F);

                event.setDamage(3.0);
            }
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:23,代码来源:RogueClass.java

示例2: setupEditMenu

public static void setupEditMenu(Player player) {
	Inventory inv = Bukkit.createInventory(player, Convert.getInventorySize(plugin.getChallengesFile().getChallengesAmount()), ChatColor.BOLD + "Edit Challenge");
	for(int i = 1; i <= plugin.getChallengesFile().getChallengesAmount(); i++){
		Material mat;
		if(plugin.getChallengesFile().getType(i).equalsIgnoreCase("parkour")){
			mat = Material.GOLD_BOOTS;
		}
		else if(plugin.getChallengesFile().getType(i).equalsIgnoreCase("maze")){
			mat = Material.TORCH;
		}else{
			mat = Material.GOLD_SWORD;
		}
		inv.addItem(ItemStackGenerator.createItem(mat, 0, 0,
				ChatColor.GRAY + "" + i + Convert.getOrdinalFor(i) + " Challenge", null, true));
	}
	player.openInventory(inv);
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:17,代码来源:MainInventory.java

示例3: onCraftItem

@EventHandler(priority = EventPriority.HIGH)
public void onCraftItem(CraftItemEvent event) 
{
	if( event.getRecipe().getResult().getType() == Material.STONE_SWORD
			|| event.getRecipe().getResult().getType() == Material.IRON_SWORD
			|| event.getRecipe().getResult().getType() == Material.GOLD_SWORD
			|| event.getRecipe().getResult().getType() == Material.DIAMOND_SWORD
|| event.getRecipe().getResult().getType() == Material.LEATHER_BOOTS
			|| event.getRecipe().getResult().getType() == Material.LEATHER_LEGGINGS
			|| event.getRecipe().getResult().getType() == Material.LEATHER_CHESTPLATE
			|| event.getRecipe().getResult().getType() == Material.LEATHER_HELMET
|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_BOOTS
			|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_LEGGINGS
			|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_CHESTPLATE
			|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_HELMET
|| event.getRecipe().getResult().getType() == Material.GOLD_BOOTS
			|| event.getRecipe().getResult().getType() == Material.GOLD_LEGGINGS
			|| event.getRecipe().getResult().getType() == Material.GOLD_CHESTPLATE
			|| event.getRecipe().getResult().getType() == Material.GOLD_HELMET
			|| event.getRecipe().getResult().getType() == Material.IRON_BOOTS
			|| event.getRecipe().getResult().getType() == Material.IRON_LEGGINGS
			|| event.getRecipe().getResult().getType() == Material.IRON_CHESTPLATE
			|| event.getRecipe().getResult().getType() == Material.IRON_HELMET
			|| event.getRecipe().getResult().getType() == Material.DIAMOND_BOOTS
			|| event.getRecipe().getResult().getType() == Material.DIAMOND_LEGGINGS
			|| event.getRecipe().getResult().getType() == Material.DIAMOND_CHESTPLATE
			|| event.getRecipe().getResult().getType() == Material.DIAMOND_HELMET)
	{
		if( event.getWhoClicked().getType() == EntityType.PLAYER )
		{
			Player p = (Player)event.getWhoClicked();
			p.sendMessage("Sorry, you are not allowed to craft this item. Purchase it from a Safe Dock instead.");
		}
		event.setCancelled(false);
	}
 
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:37,代码来源:NavyCraft_InventoryListener.java

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

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

示例6: getTypeMaterial

public Material getTypeMaterial(int challenge) {
	String type = getType(challenge);
	if("parkour".equalsIgnoreCase(type))
		return Material.GOLD_BOOTS;
	else if("maze".equalsIgnoreCase(type))
		return Material.TORCH;
	else return Material.GOLD_SWORD;
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:8,代码来源:ChallengesFile.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


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