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


Java Material.GOLD_INGOT属性代码示例

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


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

示例1: onPickUp

@EventHandler
public void onPickUp(PlayerPickupItemEvent e){
    Player p = e.getPlayer();

    if (e.getItem().getItemStack().getType() == Material.GOLD_INGOT){
        double money = Double.parseDouble(ChatColor.stripColor(e.getItem().getItemStack().getItemMeta().getDisplayName().split(" ")[0].replaceAll("€", "")));

        new Economy(p).addMoney(money);
        p.sendMessage(ChatColor.GREEN + "Añadidas " + ChatColor.YELLOW + money + ChatColor.GREEN + " esmeraldas");
        e.getItem().remove();
    }
}
 
开发者ID:cadox8,项目名称:WC,代码行数:12,代码来源:WorldInteract.java

示例2: getCoinsIcon

protected static ItemStack getCoinsIcon(Player player)
{
    long coins = SamaGamesAPI.get().getPlayerManager().getPlayerData(player.getUniqueId()).getCoins();

    ItemStack stack = new ItemStack(Material.GOLD_INGOT, 1);
    ItemMeta meta = stack.getItemMeta();
    meta.setDisplayName(ChatColor.GOLD + "Vous avez " + NumberUtils.format(coins) + " pièces");
    stack.setItemMeta(meta);

    return stack;
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:11,代码来源:AbstractGui.java

示例3: addMetaIfNeeded

private ItemStack addMetaIfNeeded(ItemStack stack)
{
    Material material = stack.getType();

    if (material == Material.COAL || material == Material.IRON_INGOT || material == Material.GOLD_INGOT || material == Material.DIAMOND || material == Material.EMERALD || material == Material.QUARTZ)
        return Meta.addMeta(stack);
    else
        return stack;
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:9,代码来源:RandomChestModule.java

示例4: onBlockBreak

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onBlockBreak(final BlockBreakEvent event) {
    Player player = event.getPlayer();
    if (player.getGameMode() != GameMode.CREATIVE) {
        if (player.hasPermission("hcf.listener.autosmeltore")) {
            ItemStack stack = player.getItemInHand();
            if (stack != null && stack.getType() != Material.AIR
                    && !stack.containsEnchantment(Enchantment.SILK_TOUCH)) {
                Block block = event.getBlock();
                Material dropType = null;
                switch (block.getType()) {
                    case IRON_ORE: {
                        dropType = Material.IRON_INGOT;
                        break;
                    }
                    case GOLD_ORE: {
                        dropType = Material.GOLD_INGOT;
                        break;
                    }
                    default: {
                        return;
                    }
                }
                 Location location = block.getLocation();
                 World world = location.getWorld();
                 ItemStack drop = new ItemStack(dropType, 1);
                world.dropItemNaturally(location, drop);
                block.setType(Material.AIR);
                block.getState().update();
            }
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:33,代码来源:AutoSmeltOreListener.java

示例5: prepareCraft

@EventHandler public void prepareCraft(final PrepareItemCraftEvent event) {
    Recipe recipe = event.getRecipe();
    if (event.isRepair() || recipe instanceof MerchantRecipe || recipe instanceof FurnaceRecipe) {
        return;
    }
    if (recipe.getResult() != null) {
        return;
    }
    CraftingInventory inventory = event.getInventory();
    ItemStack[] matrix = inventory.getMatrix();
    PlayerheadItemStack skull = null;
    int gold = 0, skulls = 0;
    for (ItemStack item : matrix) {
        if (item.getType() == Material.SKULL_ITEM) {
            if (item instanceof PlayerheadItemStack && ((SkullMeta) item.getItemMeta()).hasOwner()) {
                ++skulls;
                skull = (PlayerheadItemStack) item;
            }
        } else if (item.getType() == Material.GOLD_INGOT) {
            ++gold;
        }
    }
    if (skull == null || gold != 7 || skulls != 1) {
        return;
    }
    skull.setGolden(true);
    inventory.setResult(skull);
}
 
开发者ID:Project-Coalesce,项目名称:UHC,代码行数:28,代码来源:CraftingHandler.java

示例6: doInteraction

public void doInteraction(Player player, ItemStack stack)
{
    if (stack.getType() == Material.COMPASS)
    {
        this.hub.getGuiManager().openGui(player, new GuiMain(this.hub));
    }
    else if (stack.getType() == Material.SKULL_ITEM)
    {
        this.hub.getGuiManager().openGui(player, new GuiProfile(this.hub));
    }
    else if (stack.getType() == Material.ENDER_CHEST)
    {
        this.hub.getGuiManager().openGui(player, new GuiCosmetics(this.hub));
    }
    else if (stack.getType() == Material.GOLD_INGOT)
    {
        this.hub.getGuiManager().openGui(player, new GuiShop(this.hub));
    }
    else if (stack.getType() == Material.BARRIER && this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()) != null)
    {
        this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()).quitPlayer(player);
    }
    else if (stack.getType() == Material.ENDER_PEARL && this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()) != null)
    {
        this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()).failPlayer(player);
    }
    else if (player.getInventory().getHeldItemSlot() == 6)
    {
        this.hub.getServer().getScheduler().runTask(this.hub, () -> this.hub.getCosmeticManager().getGadgetManager().useSelectedCosmetic(player, stack));
    }
    else if (stack.getType() == Material.ELYTRA)
    {
        if (stack.getEnchantments().isEmpty())
        {
            ItemStack elytra = new ItemStack(Material.ELYTRA);
            ItemMeta meta = elytra.getItemMeta();
            meta.spigot().setUnbreakable(true);
            elytra.setItemMeta(meta);

            player.getInventory().setChestplate(elytra);
            this.setInventoryToPlayer(player);
        }
        else
        {
            player.getInventory().setChestplate(null);
            this.setInventoryToPlayer(player);
        }

        player.playSound(player.getLocation(), Sound.ENTITY_HORSE_SADDLE, 1F, 1F);
    }
    else if (stack.getType() == Material.FEATHER && player.isGliding() && player.getVelocity().lengthSquared() != 0)
    {
        if (!SamaGamesAPI.get().getPermissionsManager().hasPermission(player, "network.vip"))
        {
            player.sendMessage(ChatColor.RED + "Devenez VIP pour utiliser le booster.");
            return;
        }

        Vector velocity = player.getVelocity().add(player.getLocation().getDirection().normalize().multiply(1.5D));
        ((CraftPlayer)player).getHandle().motX = velocity.getX();
        ((CraftPlayer)player).getHandle().motY = velocity.getY();
        ((CraftPlayer)player).getHandle().motZ = velocity.getZ();
        ((CraftPlayer)player).getHandle().velocityChanged = true;
        player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 2F, 2F);

        this.hub.getServer().getScheduler().runTask(this.hub, () -> SamaGamesAPI.get().getAchievementManager().getAchievementByID(5).unlock(player.getUniqueId()));
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:68,代码来源:StaticInventory.java


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