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


Java Material.DIAMOND_PICKAXE属性代码示例

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


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

示例1: createItemStack

static /* varargs */ ItemStack createItemStack(String... lores)
{
    ItemStack stack = new ItemStack(Material.DIAMOND_PICKAXE, 1);
    ItemMeta im = stack.getItemMeta(); 
    im.setDisplayName("");
    ArrayList < String > lore = new ArrayList<>();
    int n = lores.length;
    int n2 = 0; 
    while (n2 < n)
    {
        String str = lores[n2];
        lore.add(str);  ++n2; 
    }
    im.setLore(lore); 
    stack.setItemMeta(im); 
    return stack; 
}
 
开发者ID:ThePhilderbeast,项目名称:prisonPicks,代码行数:17,代码来源:Util.java

示例2: onCraftItem

@EventHandler
public void onCraftItem(CraftItemEvent event)
{
    if (event.getRecipe().getResult().getType() == Material.DIAMOND_PICKAXE)
    {
        ItemStack pickaxe = new ItemStack(Material.DIAMOND_PICKAXE, 1);
        pickaxe.addEnchantment(Enchantment.DIG_SPEED, 3);

        event.getInventory().setResult(pickaxe);

        this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () ->
        {
            for (ItemStack stack : event.getWhoClicked().getInventory().getContents())
                if (stack != null && stack.getType() == Material.DIAMOND_PICKAXE && !stack.containsEnchantment(Enchantment.DIG_SPEED))
                    stack.addEnchantment(Enchantment.DIG_SPEED, 3);
        }, 5L);
    }
}
 
开发者ID:SamaGames,项目名称:DoubleRunner,代码行数:18,代码来源:DoubleRunnerGameLoop.java

示例3: getRepresentation

/**
 * {@inheritDoc}
 */
@Override
public default ItemStack getRepresentation() {
	ItemStack stack = new ItemStack(Material.DIAMOND_PICKAXE);
	ItemMeta meta = stack.getItemMeta();
	meta.setDisplayName(ChatColor.GRAY + "Repair");
	stack.setItemMeta(meta);
	stack.setDurability((short) 1);
	return stack;
}
 
开发者ID:Jannyboy11,项目名称:CustomRecipes,代码行数:12,代码来源:RepairRecipe.java

示例4: onCommand

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
    if(!(sender instanceof Player)){
        sender.sendMessage("Only players can use this command.");
        return true;
    }
    if(args != null && args.length > 0){
        if(args[0].equalsIgnoreCase("toggle")){
            active = !active;
            for(Player p: Bukkit.getOnlinePlayers()){
                if(p.isOp()){
                    p.sendMessage(String.format("Ghost Block protection is now %s", active ? "active" : "disabled"));
                }
            }
            return true;
        }
        return false;
    }
    Player player = (Player)sender;
    ItemStack pic = new ItemStack(Material.DIAMOND_PICKAXE);
    ItemMeta meta = pic.getItemMeta();
    meta.setUnbreakable(true);
    meta.addEnchant(Enchantment.DIG_SPEED, 5, true);
    pic.setItemMeta(meta);
    player.getInventory().addItem(pic);
    player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 60000, 2, true, false), true);
    player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 60000, 1, true, false), true);
    return true;
}
 
开发者ID:RypoFalem,项目名称:GhostBuster,代码行数:29,代码来源:GhostBusterPlugin.java

示例5: onBlockDamage

/**
 * Set obsidian only breakable by a diamond pickage
 *
 * @param event Event
 */
@EventHandler
public void onBlockDamage(BlockDamageEvent event)
{
    if (event.getBlock().getType() == Material.OBSIDIAN && event.getItemInHand().getType() != Material.DIAMOND_PICKAXE)
        event.setCancelled(true);
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:11,代码来源:HardObsidianModule.java

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

示例7: getDrops

@Override
public Collection<ItemStack> getDrops( FlexPlayer player, int data ) {
    ItemStack itemStack = player.getItemInHand();
    if( itemStack != null && ( itemStack.getType() == Material.IRON_PICKAXE || itemStack.getType() == Material.DIAMOND_PICKAXE ) ) {
        return Collections.singletonList( new ItemStack( Material.DIAMOND ) );
    }
    return Collections.emptyList();
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:8,代码来源:BlockDiamondOre.java

示例8: getProgressBar

public ItemStack getProgressBar()
{
    return new ItemStack(Material.DIAMOND_PICKAXE);
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:4,代码来源:NetherDrill.java

示例9: isPick

static boolean isPick(ItemStack item)
{
    return item != null && item.getType() == Material.DIAMOND_PICKAXE && item.hasItemMeta() && item.getItemMeta().hasLore();
}
 
开发者ID:ThePhilderbeast,项目名称:prisonPicks,代码行数:4,代码来源:Pick.java

示例10: getProgressBar

@Override
public ItemStack getProgressBar() {
	return new ItemStack(Material.DIAMOND_PICKAXE);
}
 
开发者ID:TheBusyBiscuit,项目名称:ChestTerminal,代码行数:4,代码来源:QuartzDrill.java

示例11: onBlockBreak

@EventHandler(priority = EventPriority.LOWEST)
public void onBlockBreak(BlockBreakEvent evt) {
	Player player = evt.getPlayer();
	if (player == null) {
		return;
	}
	ItemStack itemStack = player.getItemInHand();
	if (itemStack.getType() != Material.DIAMOND_PICKAXE) {
		return;
	}
	ItemMeta itemMeta = itemStack.getItemMeta();
	if (itemMeta == null) {
		return;
	}
	String displayName = itemMeta.getDisplayName();
	if (displayName == null) {
		return;
	}
	if (!displayName.contains(ITEM_NAME)) {
		return;
	}
	Block block = evt.getBlock();
	if (block == null) {
		return;
	}
	Location location = block.getLocation();
	String playerName = player.getName();
	Location[][] arrayOfLocation;
	int j = (arrayOfLocation = LocationUtil.getExplosivePickaxeBreakLocations(location)).length;
	for (int i = 0; i < j; i++) {
		Location[] locations = arrayOfLocation[i];
		Location[] arrayOfLocation1;
		int m = (arrayOfLocation1 = locations).length;
		for (int k = 0; k < m; k++) {
			Location FOR_location = arrayOfLocation1[k];
			ClaimedResidence claimedResidence = RESIDENCE_MAMAGER.getByLoc(FOR_location);
			if (claimedResidence != null) {
				ResidencePermissions perms = claimedResidence.getPermissions();
				boolean hasdestroy = perms.playerHas(playerName, Flags.destroy, true);
				if ((!hasdestroy) && (!player.hasPermission("residence.bypass.destroy"))) {
					this.RESIDENCE.msg(player, lm.Flag_Deny, new Object[] { Flags.destroy });
					evt.setCancelled(true);
					return;
				}
			}
		}
	}
}
 
开发者ID:Soldier233,项目名称:SlimefunBugFixer,代码行数:48,代码来源:ListenersRes4.java


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