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


Java ItemFactory.getItemMeta方法代码示例

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


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

示例1: giveItem

import org.bukkit.inventory.ItemFactory; //导入方法依赖的package包/类
public void giveItem(Player ply, Registration plugin) {
	ItemStack i = new ItemStack(Material.WRITTEN_BOOK);
	
	ItemFactory itemFactory = plugin.getServer().getItemFactory();
	
	BookMeta bookMeta = (BookMeta) itemFactory.getItemMeta(Material.WRITTEN_BOOK);
	
	bookMeta.setTitle("The Manual");
	bookMeta.setAuthor("Shank");
	bookMeta.setPages("Welcome to BlockShock, a ShankShock Production.\n\nThis manual contains the rules, commands, and basics for surviving on the server.\n\nMore info @ ShankShock.Com.",
			"## The Rules\n\n1. No chat spamming.\n2. No hacking mods.\n3. Don't steal, break, or cause grief to any player or their creations.\n4. Don't ask for admin.\n5. Don't advertise.\n6. Respect all players.",
			"## Commands\n\n1. The usual home/warp commands.\n2. /inventory\n3. /shop\n4. /name",
			"## Mods\n\nExplosions & TNT are disabled. Creepers can't break your stuff. You can't drown. Falling damage and fire spread are disabled too.",
			"## Conversations\n\nSome commands, such as the inventory and shop commands, will take over your chat box. Simply type a response to what they ask for to use them. You can always exit with /quit.",
			"## Exiting Spawn\n\nTo exit spawn, simply warp to another location.\n\n/warp ShadowVale",
			"## Help\n\nAdmins have light blue name colors in chat. The owners are dark red and cyan. You can ask them for any help you need, though they don't have to give it. Admins aren't your slaves.",
			"## More Info\n\nMore information can be found at:\n\nwiki.shankshock.com\nshankshock.com");
	
	i.setItemMeta(bookMeta);
	
	ply.getInventory().addItem(i);
}
 
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:23,代码来源:RuleBookItem.java

示例2: unbox

import org.bukkit.inventory.ItemFactory; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public ItemMeta unbox() {

	ItemFactory factory = Bukkit.getServer().getItemFactory();
	EnchantmentStorageMeta meta = (EnchantmentStorageMeta) factory.getItemMeta(Material.getMaterial(this.id));

	for (CardboardEnchantment e : this.enchantments.keySet()) {
		meta.addStoredEnchant(e.unbox(), this.enchantments.get(e), true);
	}
	return meta;
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:12,代码来源:CardboardMetaEnchantment.java

示例3: unbox

import org.bukkit.inventory.ItemFactory; //导入方法依赖的package包/类
public ItemStack unbox() {

		@SuppressWarnings("deprecation")
		ItemStack item = new ItemStack(type, amount, damage);

		// These metas below will never be null because of the if/else during
		// the packing

		ItemFactory factory = Bukkit.getServer().getItemFactory();
		ItemMeta itemMeta = factory.getItemMeta(Material.getMaterial(item.getTypeId()));

		// Should only have one specific item meta at a time
		if ((this.meta != null)) {
			itemMeta = this.meta.unbox();
		}
		if (this.name != null) {
			itemMeta.setDisplayName(this.name);
		}
		if (this.lore != null) {
			itemMeta.setLore(this.lore);
		}
		// Apply item meta
		item.setItemMeta(itemMeta);

		HashMap<Enchantment, Integer> map = new HashMap<Enchantment, Integer>();

		for (CardboardEnchantment cEnchantment : enchants.keySet()) {
			map.put(cEnchantment.unbox(), enchants.get(cEnchantment));
		}

		item.addUnsafeEnchantments(map);

		return item;
	}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:35,代码来源:CardboardBox.java

示例4: unbox

import org.bukkit.inventory.ItemFactory; //导入方法依赖的package包/类
public ItemMeta unbox() {

		ItemFactory factory = Bukkit.getServer().getItemFactory();
		EnchantmentStorageMeta meta = (EnchantmentStorageMeta) factory.getItemMeta(Material.getMaterial(this.id));

		for (CardboardEnchantment e : this.enchantments.keySet()) {
			meta.addStoredEnchant(e.unbox(), this.enchantments.get(e), true);
		}
		return meta;
	}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:11,代码来源:CardboardMetaEnchantment.java

示例5: unbox

import org.bukkit.inventory.ItemFactory; //导入方法依赖的package包/类
public ItemStack unbox() {

		ItemStack item = new ItemStack(type, amount, damage);

		// These metas below will never be null because of the if/else during
		// the packing

		ItemFactory factory = Bukkit.getServer().getItemFactory();
		ItemMeta itemMeta = factory.getItemMeta(Material.getMaterial(item.getTypeId()));

		// Should only have one specific item meta at a time
		if ((this.meta != null)) {
			itemMeta = this.meta.unbox();
		}
		if (this.name != null) {
			itemMeta.setDisplayName(this.name);
		}
		if (this.lore != null) {
			itemMeta.setLore(this.lore);
		}
		// Apply item meta
		item.setItemMeta(itemMeta);

		HashMap<Enchantment, Integer> map = new HashMap<Enchantment, Integer>();

		for (CardboardEnchantment cEnchantment : enchants.keySet()) {
			map.put(cEnchantment.unbox(), enchants.get(cEnchantment));
		}

		item.addUnsafeEnchantments(map);

		return item;
	}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:34,代码来源:CardboardBox.java

示例6: value

import org.bukkit.inventory.ItemFactory; //导入方法依赖的package包/类
Material[] value() {
    final ItemFactory factory = CraftItemFactory.instance();
    final Map<Class<? extends ItemMeta>, Material> possibleMaterials = new HashMap<Class<? extends ItemMeta>, Material>();
    for (final Material material : Material.values()) {
        final ItemMeta meta = factory.getItemMeta(material);
        if (meta == null || possibleMaterials.containsKey(meta.getClass()))
            continue;
        possibleMaterials.put(meta.getClass(), material);

    }
    return possibleMaterials.values().toArray(new Material[possibleMaterials.size()]);
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:13,代码来源:ItemStackTest.java


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