Examples of ItemMeta


Examples of org.bukkit.inventory.meta.ItemMeta

        ItemStack item = null;

        // Create head item with chosen skin, or item/skin
        if (skin != null) {
            item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
            ItemMeta itemMeta = item.getItemMeta();
            ((SkullMeta) itemMeta).setOwner(skin.asString().replaceAll("[pP]@", ""));
            item.setItemMeta(itemMeta);

        } else if (material != null)
            item = new ItemStack(material.getMaterial());
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

      }
     
      // Mock the server object
      Server mockedServer = mock(Server.class);
      ItemFactory mockedFactory = mock(CraftItemFactory.class);
      ItemMeta mockedMeta = mock(ItemMeta.class);
 
      when(mockedServer.getItemFactory()).thenReturn(mockedFactory);
      when(mockedServer.isPrimaryThread()).thenReturn(true);
      when(mockedFactory.getItemMeta(any(Material.class))).thenReturn(mockedMeta);
 
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

        // @tags
        // <i@item.display>
        // -->

        if (mechanism.matches("display_name")) {
            ItemMeta meta = item.getItemStack().getItemMeta();
            meta.setDisplayName(EscapeTags.unEscape(mechanism.getValue().asString()));
            item.getItemStack().setItemMeta(meta);
        }
    }
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

            item = new ItemStack(Material.STAINED_GLASS_PANE);
            item.getData().setData((byte) 8);
        }
        else
            item = item.clone();
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(message);
        item.setItemMeta(meta);
        PacketPlayOutSetSlot slotPacket = getSlotPacket(player.getUniqueId(),
                player.getInventory().getHeldItemSlot() + 36, item);
        PacketHelper.sendPacket(player, slotPacket);
    }
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

        // @tags
        // <i@item.lore>
        // -->

        if (mechanism.matches("lore")) {
            ItemMeta meta = item.getItemStack().getItemMeta();
            dList lore = mechanism.getValue().asType(dList.class);
            if (item.isItemscript())
                lore.add(ItemScriptHelper.createItemScriptID(item.getScriptName()));
            for (int i = 0; i < lore.size(); i++) {
                lore.set(i, EscapeTags.unEscape(lore.get(i)));
            }
            meta.setLore(lore);
            item.getItemStack().setItemMeta(meta);
        }

    }
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

        // <i@item.firework>
        // -->

        if (mechanism.matches("firework")) {
            dList fireworks = mechanism.getValue().asType(dList.class);
            ItemMeta meta = item.getItemStack().getItemMeta();
            for (String effect: fireworks) {
                String[] data = effect.split(",");
                if (data.length == 9) {
                    FireworkEffect.Builder builder = FireworkEffect.builder();
                    builder.trail(new Element(data[0]).asBoolean());
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

            }

            // Make sure we're working with a valid base ItemStack
            if (stack == null) return null;

            ItemMeta meta = stack.getItemStack().getItemMeta();
            List<String> lore = new ArrayList<String>();

            // Set Id of the first, invisible lore
            boolean hideLore = false;
            if (contains("NO_ID")) {
                hideLore = Boolean.valueOf(getString("NO_ID"));
            }
            if (!hideLore)
                lore.add(hash);

            // Set Display Name
            if (contains("DISPLAY NAME")){
                String displayName = TagManager.tag(player, npc, getString("DISPLAY NAME"), false, null, debug, new dScript(this));
                meta.setDisplayName(displayName);
            }

            // Set if the object is bound to the player
            if (contains("BOUND")) {
                bound = Boolean.valueOf(TagManager.tag(player, npc, getString("BOUND"), false, null, debug, new dScript(this)));
            }

            // Set Lore
            if (contains("LORE")) {

                for (String l : getStringList("LORE")){
                     l = TagManager.tag(player, npc, l, false, null, debug, new dScript(this));
                     lore.add(l);
                }
            }

            meta.setLore(lore);
            stack.getItemStack().setItemMeta(meta);

            // Set Enchantments
            if (contains("ENCHANTMENTS")) {
                for (String enchantment : getStringList("ENCHANTMENTS")) {
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

    }

    public InventoryMenuItem(String text, MaterialData icon, int amount) {
        item = new ItemStack(icon.getItemType(), 1, icon.getData());

        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(text);
        item.setItemMeta(meta);

        item.setAmount(amount);
    }
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

    public String getText() {
        return item.getItemMeta().getDisplayName();
    }

    public void setDescriptions(String... lines) {
        ItemMeta meta = item.getItemMeta();
        List<String> lore = new ArrayList<String>();

        for (String s : lines) {
            lore.addAll(Arrays.asList(Utilities.wrapWords(s, 24)));
        }

        meta.setLore(lore);
        item.setItemMeta(meta);
    }
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

                    builder.append("|$IGNORE");
                List<String> list = item.getItemMeta().getLore();
                for(String s : list)
                    builder.append("|").append(s);
            }
            ItemMeta meta = item.getItemMeta();
            if (meta instanceof SkullMeta) {
                if(((SkullMeta) meta).hasOwner())
                    builder.append("/player:").append(((SkullMeta) meta).getOwner());
            } else if (meta instanceof BookMeta) {
                if(((BookMeta) meta).hasTitle())
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.