當前位置: 首頁>>代碼示例>>Java>>正文


Java ItemFlag類代碼示例

本文整理匯總了Java中org.bukkit.inventory.ItemFlag的典型用法代碼示例。如果您正苦於以下問題:Java ItemFlag類的具體用法?Java ItemFlag怎麽用?Java ItemFlag使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ItemFlag類屬於org.bukkit.inventory包,在下文中一共展示了ItemFlag類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setVale

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
public static void setVale(Player player, int amount) throws SQLException {
    UUID uuid = player.getUniqueId();
    PreparedStatement stmt = plugin.getDb().getConnection().prepareStatement("UPDATE vale_eco SET amount = "+amount+" WHERE uuid = '"+uuid.toString()+"'");
    stmt.executeUpdate();

    ItemStack item = new ItemStack(Material.EMERALD, 1);
    ItemMeta meta = item.getItemMeta();
    meta.setDisplayName(ChatColor.GREEN.toString() + getVale(player) + (getVale(player)==1?" Vale":" Vales"));
    meta.addEnchant(Enchantment.LUCK, 1, true);
    meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
    item.setItemMeta(meta);
    if(plugin.getConfig().getString("valeitemininv").equals("true")){
        player.getInventory().setItem(8, item);
    }

}
 
開發者ID:Warvale,項目名稱:NetworkCore,代碼行數:17,代碼來源:ValeUtil.java

示例2: generate

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
@Override
public ItemStack generate() {
    ItemStack item = new ItemStack(material);
    ItemMeta im = item.getItemMeta();
    im.setDisplayName(name);
    ArrayList<String> lore = new ArrayList<String>();
    if (soulbound) {
        lore.add(ChatColor.RED + ChatColor.ITALIC.toString() + "Soulbound");
    }
    if (description.length() > 0)
        lore.addAll(RFormatter.stringToLore(description, ChatColor.GRAY));
    im.setLore(lore);
    im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
    im.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
    item.setItemMeta(im);
    return item;
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:18,代碼來源:EtcItem.java

示例3: createItem

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
public static ItemStack createItem(Material material, int amount, short data, String displayname, List<String> lore) {
    ItemStack item = new ItemStack(material, amount, data);
    ItemMeta meta = item.getItemMeta();
    meta.setDisplayName(Utils.colorize(displayname));
    ArrayList<String> colorLore = new ArrayList<>();
    if (lore != null) {
        lore.forEach(str -> colorLore.add(Utils.colorize(str)));
        meta.setLore(colorLore);
    }

    meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_ATTRIBUTES,
            ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_UNBREAKABLE);

    item.setItemMeta(meta);
    return item;
}
 
開發者ID:cadox8,項目名稱:WC,代碼行數:17,代碼來源:ItemUtil.java

示例4: openFakeInv

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
/**
 * Copy an inventory and open it for player
 *
 * @param i Inventory to open
 * @param p Player that needs the inventory
 */
public static void openFakeInv(Inventory i, OMGPlayer p) {
    Inventory fake = Bukkit.createInventory(p.bukkit, i.getSize(), i.getTitle());
    for (int slot = 0; slot < i.getContents().length; slot++) {
        ItemStack e = i.getContents()[slot];
        if (e != null) {
            e = e.clone();
            ItemMeta im = e.getItemMeta();
            im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
            im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
            if ((NBTParser.getTagCompound(e).hasKey("kitid") && NBTParser.getTagCompound(e).getString("kitid").equals(p.kit.name)) || (NBTParser.getTagCompound(e).hasKey("teamid") && NBTParser.getTagCompound(e).getString("teamid").equals(p.requestedTeam.id)))
                im.addEnchant(Enchantment.DURABILITY, 1, true);
            if (NBTParser.getTagCompound(e).hasKey("kitid")) {
                ItemStack finalE = e;
                OMGKit.kits.stream().filter(k -> k.getName().equals(NBTParser.getTagCompound(finalE).getString("kitid"))).forEach(k -> {
                    List<String> ss = im.hasLore() ? im.getLore() : new ArrayList<>();
                    ss.add(ChatColor.GREEN + "Can use: " + (OMGPI.g.player_hasKit(p, k) ? (ChatColor.GREEN + "YES") : (ChatColor.RED + "NO")));
                    im.setLore(ss);
                });
            }
            e.setItemMeta(im);
            fake.setItem(slot, e);
        }
    }
    p.bukkit.openInventory(fake);
}
 
開發者ID:BurnyDaKath,項目名稱:OMGPI,代碼行數:32,代碼來源:Inventories.java

示例5: createGlass

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
public static ItemStack createGlass(String displayname, List<String> lore, DyeColor dye) {
    ItemStack item = new ItemStack(Material.STAINED_GLASS_PANE, 1, dye.getWoolData());
    ItemMeta meta = item.getItemMeta();
    meta.setDisplayName(Utils.colorize(displayname));

    ArrayList<String> colorLore = new ArrayList<>();
    if (lore != null) {
        lore.forEach(str -> colorLore.add(Utils.colorize(str)));
        meta.setLore(colorLore);
    }

    meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_ATTRIBUTES,
            ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_UNBREAKABLE);
    item.setItemMeta(meta);
    return item;
}
 
開發者ID:cadox8,項目名稱:WC,代碼行數:17,代碼來源:ItemUtil.java

示例6: createHeadPlayer

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
public static ItemStack createHeadPlayer(String displayname, String username, List<String> lore) {
    ItemStack playerHead = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
    SkullMeta sm = (SkullMeta)playerHead.getItemMeta();
    sm.setOwner(username);
    ArrayList<String> colorLore = new ArrayList<>();
    if (lore != null) {
        lore.forEach(str -> colorLore.add(Utils.colorize(str)));
        sm.setLore(colorLore);
    }

    sm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_ATTRIBUTES,
            ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_UNBREAKABLE);
    sm.setDisplayName(Utils.colorize(displayname));
    playerHead.setItemMeta(sm);
    return playerHead;
}
 
開發者ID:cadox8,項目名稱:WC,代碼行數:17,代碼來源:ItemUtil.java

示例7: giveKit

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
@EventHandler
public void giveKit(final ObserverKitApplyEvent event) {
    final MatchPlayer player = mm.getPlayer(event.getPlayer());
    if(player == null) return;
    if(!player.isObservingType()) return;
    if(!player.getBukkit().hasPermission("pgm.defuse")) return;

    ItemStack shears = new ItemStack(DEFUSE_ITEM);

    // TODO: Update information if locale changes
    ItemMeta meta = shears.getItemMeta();
    meta.addItemFlags(ItemFlag.values());
    meta.setDisplayName(PGMTranslations.t("defuse.displayName", player));
    meta.setLore(Lists.newArrayList(ChatColor.GRAY + PGMTranslations.t("defuse.tooltip", player)));
    shears.setItemMeta(meta);

    event.getPlayer().getInventory().setItem(DEFUSE_SLOT, shears);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:19,代碼來源:DefuseListener.java

示例8: createJoinButton

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
private ItemStack createJoinButton(final MatchPlayer player) {
    ItemStack stack = new ItemStack(Button.JOIN.material);

    ItemMeta meta = stack.getItemMeta();
    meta.addItemFlags(ItemFlag.values());

    String key;
    if(!canOpenWindow(player)) {
        key = "ffa.picker.displayName";
    } else if(hasTeams && hasClasses) {
        key = "teamClass.picker.displayName";
    } else if(hasTeams) {
        key = "teamSelection.picker.displayName";
    } else if(hasClasses) {
        key = "class.picker.displayName";
    } else {
        key = "ffa.picker.displayName";
    }

    meta.setDisplayName(OPEN_BUTTON_PREFIX + PGMTranslations.t(key, player));
    meta.setLore(Lists.newArrayList(ChatColor.DARK_PURPLE + PGMTranslations.t("teamSelection.picker.tooltip", player)));

    stack.setItemMeta(meta);
    ITEM_TAG.set(stack, "join");
    return stack;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:27,代碼來源:PickerMatchModule.java

示例9: createClassButton

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
private ItemStack createClassButton(MatchPlayer viewer, PlayerClass cls) {
    ItemStack item = cls.getIcon().toItemStack(1);
    ItemMeta meta = item.getItemMeta();
    meta.addItemFlags(ItemFlag.values());

    meta.setDisplayName((cls.canUse(viewer.getBukkit()) ? ChatColor.GREEN : ChatColor.RED) + cls.getName());
    if(getMatch().getMatchModule(ClassMatchModule.class).selectedClass(viewer.getDocument()).equals(cls)) {
        meta.addEnchant(Enchantment.ARROW_INFINITE, 1, true);
    }

    List<String> lore = Lists.newArrayList();
    if(cls.getLongDescription() != null) {
        ChatUtils.wordWrap(ChatColor.GOLD + cls.getLongDescription(), LORE_WIDTH_PIXELS, lore);
    } else if(cls.getDescription() != null) {
        lore.add(ChatColor.GOLD + cls.getDescription());
    }

    if(!cls.canUse(viewer.getBukkit())) {
        lore.add(ChatColor.RED + PGMTranslations.t("class.picker.restricted", viewer));
    }

    meta.setLore(lore);
    item.setItemMeta(meta);

    return item;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:27,代碼來源:PickerMatchModule.java

示例10: getEmpireWand

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
public ItemStack getEmpireWand() {

	
		ItemStack empirewand = new ItemStack(Material.BLAZE_ROD, 1);
		ItemMeta meta = empirewand.getItemMeta();
		meta.setDisplayName(ChatColor.RED + "Empire Wand");
		ArrayList<String> lore = new ArrayList<String>();
		try {
			lore.add(ChatColor.translateAlternateColorCodes('&', new Randomizer<String>(KingdomFactionsPlugin.getInstance()
							.getDataManager().getArrayData("Empirewand.lores").getValue()).result()));
		} catch (DataException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		meta.setLore(lore);
		meta.addEnchant(Enchantment.LURE, 1, true);
		meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
		empirewand.setItemMeta(meta);
		
		return empirewand;
	}
 
開發者ID:ThEWiZ76,項目名稱:KingdomFactions,代碼行數:22,代碼來源:EmpireWandModule.java

示例11: setupGUI

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
private void setupGUI() {
    gui = Bukkit.createInventory(null, 27, FMessage.POPULATION_ADJUST_CONSUME.getMessage(faction.getName()));
    ItemStack banner = faction.getBannerStack();
    ItemMeta meta = banner.getItemMeta();
    meta.setDisplayName(ChatColor.GOLD + faction.getName());
    meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
    banner.setItemMeta(meta);
    gui.setItem(0, GUIButton.BACK);
    gui.setItem(1, banner);
    gui.setItem(2, banner);
    gui.setItem(3, banner);
    gui.setItem(5, banner);
    gui.setItem(6, banner);
    gui.setItem(7, banner);
    gui.setItem(8, banner);
    gui.setItem(13, GRANT_BUTTON);
}
 
開發者ID:DRE2N,項目名稱:FactionsXL,代碼行數:18,代碼來源:SaturationMenu.java

示例12: formButton

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
public static ItemStack formButton(Faction faction, Resource resource) {
    ItemStack icon = resource.getIcon();
    ItemMeta meta = icon.getItemMeta();
    SaturationLevel level = faction.isResourceSaturated(resource);
    if (level == SaturationLevel.SURPLUS) {
        meta.addEnchant(Enchantment.LUCK, 1, true);
        meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
    }
    meta.setDisplayName(level.getColor() + resource.getName());
    ArrayList<String> lore = new ArrayList<>();
    lore.add(ProgressBar.getBar((double) faction.getSaturatedResources().get(resource)));
    lore.add(level.getColor().toString() + faction.getSaturatedResources().get(resource) + "%");
    String population = String.valueOf(faction.getPopulation());
    String units = String.valueOf(faction.getDemand(resource));
    lore.add(FMessage.POPULATION_REQUIRED.getMessage(population, units, resource.getName()));
    lore.add(FMessage.POPULATION_GRANTING1.getMessage());
    lore.add(FMessage.POPULATION_GRANTING2.getMessage(String.valueOf(faction.getConsumableResources().get(resource)), resource.getName()));
    meta.setLore(lore);
    icon.setItemMeta(meta);
    return icon;
}
 
開發者ID:DRE2N,項目名稱:FactionsXL,代碼行數:22,代碼來源:DemandMenu.java

示例13: setupGUI

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
private void setupGUI() {
    gui = Bukkit.createInventory(null, 27, FMessage.TRADE_RESOURCE_TITLE.getMessage(resource.getName(), faction.getName()));
    ItemStack banner = faction.getBannerStack();
    ItemMeta meta = banner.getItemMeta();
    meta.setDisplayName(ChatColor.GOLD + faction.getName());
    meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
    banner.setItemMeta(meta);
    gui.setItem(0, BACK);
    gui.setItem(1, banner);
    gui.setItem(2, banner);
    gui.setItem(3, banner);
    gui.setItem(5, banner);
    gui.setItem(6, banner);
    gui.setItem(7, banner);
    gui.setItem(8, banner);
    gui.setItem(13, importButton);
    gui.setItem(22, exportButton);
}
 
開發者ID:DRE2N,項目名稱:FactionsXL,代碼行數:19,代碼來源:ResourceMenu.java

示例14: choosePartner

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
private Inventory choosePartner(Faction creator) {
    int size = (int) (9 * Math.ceil(((double) factions.getActive().size() / 9)));
    Inventory gui = Bukkit.createInventory(null, size, FMessage.TRADE_OFFER_CHOOSE_PARTNER.getMessage());
    int i = 0;
    for (Faction faction : factions.getActive()) {
        ItemStack icon = faction.getBannerStack();
        ItemMeta meta = icon.getItemMeta();
        meta.setDisplayName(creator.getRelation(faction).getColor() + faction.getName());
        meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
        icon.setItemMeta(meta);
        gui.setItem(i, icon);
        factionBySlot.put(i, faction);
        i++;
    }
    return gui;
}
 
開發者ID:DRE2N,項目名稱:FactionsXL,代碼行數:17,代碼來源:TradeOfferCommand.java

示例15: build

import org.bukkit.inventory.ItemFlag; //導入依賴的package包/類
/**
 * Get the final {@link ItemStack} with all the attributes you have been adding
 *
 * @return the {@link ItemStack} of this {@link ItemBuilder}
 */
@Override
public ItemStack build() {
    ItemStack s = new ItemStack(this.getMaterial());
    s.setAmount(this.getAmount());
    s.setDurability(this.getDamage());
    LeatherArmorMeta m = (LeatherArmorMeta) s.getItemMeta();

    for (ItemFlag iflag : this.getAllItemflags()) {
        m.addItemFlags(iflag);
    }
    m.setDisplayName(this.getName());
    m.setLore(this.getLore());
    m.setColor(color);
    s.setItemMeta(m);
    for (Map.Entry<Enchantment, Integer> temp : this.getAllEnchantments().entrySet()) {
        s.addUnsafeEnchantment(temp.getKey(), temp.getValue());
    }
    return s;
}
 
開發者ID:AlphaHelixDev,項目名稱:AlphaLibary,代碼行數:25,代碼來源:LeatherItemBuilder.java


注:本文中的org.bukkit.inventory.ItemFlag類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。