當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。