本文整理汇总了Java中org.bukkit.inventory.meta.ItemMeta.addItemFlags方法的典型用法代码示例。如果您正苦于以下问题:Java ItemMeta.addItemFlags方法的具体用法?Java ItemMeta.addItemFlags怎么用?Java ItemMeta.addItemFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.inventory.meta.ItemMeta
的用法示例。
在下文中一共展示了ItemMeta.addItemFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的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;
}
示例2: build
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
/**
* Get the final {@link ItemStack} with all the attributes you have been adding
*
* @return the {@link ItemStack} out of this {@link ItemBuilder}
*/
public ItemStack build() {
ItemStack s = new ItemStack(material);
s.setAmount(amount);
s.setDurability(damage);
ItemMeta m = s.getItemMeta();
for (ItemFlag iflag : itemflags)
m.addItemFlags(iflag);
m.setDisplayName(name);
m.setLore(lore);
s.setItemMeta(m);
for (Map.Entry<Enchantment, Integer> temp : enchantments.entrySet())
s.addUnsafeEnchantment(temp.getKey(), temp.getValue());
for (ItemData id : getAllData())
try {
id.applyOn(s);
} catch (WrongDataException e) {
e.printStackTrace();
}
return s;
}
示例3: createJoinButton
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的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;
}
示例4: formButton
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的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;
}
示例5: getInventoryItem
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
/**
* Gets a {@link InventoryItem} out of this {@link SimpleFile}
*
* @param path where the {@link InventoryItem} should be located at
* @return the {@link InventoryItem} which was saved
*/
public InventoryItem getInventoryItem(String path) {
String name = getColorString(path + ".name");
Material type = getMaterial(path + ".type");
int amount = getValue(path + ".amount");
short damage = getValue(path + ".damage");
HashMap<String, String> ench = getMap(path + ".enchantments");
List<String> lore = getValue(path + ".lore");
List<String> flags = getValue(path + ".flags");
ItemStack stack = new ItemStack(type, amount, damage);
ItemMeta meta = stack.getItemMeta();
meta.setLore(lore);
meta.setDisplayName(name);
for (String enchantment : ench.keySet()) {
meta.addEnchant(Enchantment.getByName(enchantment), Integer.parseInt(ench.get(enchantment)), true);
}
for (String flag : flags) {
meta.addItemFlags(ItemFlag.valueOf(flag));
}
stack.setItemMeta(meta);
return new InventoryItem(stack, getValue(path + ".slot"));
}
示例6: initialize
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
@Override
public void initialize() {
ItemMeta im;
grapple = new ItemStack(Material.FISHING_ROD);
im = grapple.getItemMeta();
im.addEnchant(Enchantment.DURABILITY, 5, true);
im.setDisplayName(ChatColor.GOLD + "Grappling Hook");
im.setLore(Arrays.asList(new String[] { ChatColor.YELLOW + "It's adventure time!", "", ChatColor.GREEN + "Right-click to shoot a hook.", ChatColor.GREEN + "Right-click again to grapple!" }));
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
im.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
grapple.setItemMeta(im);
}
示例7: getItem
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public ItemStack getItem(Material m, String name, int amount, HashMap<Enchantment, Integer> enchantments, boolean showEnchantments) {
ItemStack i = new ItemStack(m, amount);
ItemMeta im = i.getItemMeta();
for(Enchantment e : enchantments.keySet()) {
im.addEnchant(e, enchantments.get(e), true);
}
if (!showEnchantments) {
im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
im.setDisplayName(name);
i.setItemMeta(im);
return i;
}
示例8: SimpleWand
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public SimpleWand() {
baseItem = new ItemStack(Material.STICK, 1);
ItemMeta meta = baseItem.getItemMeta();
meta.setDisplayName(displayName + "none");
meta.setLore(Arrays.asList(new String[]{"Right click to cast", "'/bind <spell>' to bind"}));
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
meta.addEnchant(Enchantment.MENDING, 1, true);
baseItem.setItemMeta(meta);
}
示例9: createGlowingItemStack
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public static ItemStack createGlowingItemStack(Material material, short data) {
ItemStack is = new ItemStack(material, 1, data);
ItemMeta im = is.getItemMeta();
im.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 1, true);
im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
is.setItemMeta(im);
return is;
}
示例10: GUILabel
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public GUILabel(String title) {
this.title = title;
item = new ItemStack(icon, 1);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(title);
itemMeta.addItemFlags(ItemFlag.values());
item.setItemMeta(itemMeta);
}
示例11: createItem
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
private ItemStack createItem(CommandSender viewer) {
final ItemStack item = new ItemStack(TUTORIAL_ITEM);
final ItemMeta meta = item.getItemMeta();
meta.addItemFlags(ItemFlag.values());
meta.setDisplayName(renderer.renderLegacy(new Component(new TranslatableComponent("tutorial.displayName"), ChatColor.GOLD, ChatColor.BOLD), viewer));
meta.setLore(ImmutableList.of(renderer.renderLegacy(new Component(new TranslatableComponent("tutorial.tooltip", mapInfo.getColoredName()), ChatColor.WHITE), viewer)));
item.setItemMeta(meta);
return item;
}
示例12: addGlow
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public static ItemStack addGlow(ItemStack item) {
item.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
ItemMeta meta = item.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(meta);
return item;
}
示例13: withItemFlag
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public ItemStackBuilder withItemFlag(ItemFlag flag) {
if (itemStack.getType() == Material.AIR) return this;
final ItemMeta meta = itemStack.getItemMeta();
meta.addItemFlags(flag);
itemStack.setItemMeta(meta);
return this;
}
示例14: addItemFlag
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public ItemMaker addItemFlag(ItemFlag... itemFlags) {
ItemMeta itemMeta = this.itemStack.getItemMeta();
itemMeta.addItemFlags(itemFlags);
this.itemStack.setItemMeta(itemMeta);
addItemFlag(ItemFlag.HIDE_ENCHANTS);
return this;
}
示例15: setUnbreakable
import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public ItemMaker setUnbreakable(){
ItemMeta meta = this.itemStack.getItemMeta();
meta.spigot().setUnbreakable(true);
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
this.itemStack.setItemMeta(meta);
return this;
}