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


Java BookMeta.setDisplayName方法代码示例

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


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

示例1: getSpellTome

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static ItemStack getSpellTome(String label, Player crafter) {
	ItemStack i = new ItemStack(MATERIAL);
	Spell spell = MystiCraft.getSpellManager().getSpell(label);
	BookMeta meta = (BookMeta)i.getItemMeta();
	meta.setDisplayName(DISPLAY_NAME + StringUtils.capitalize(label));
	if (crafter != null)
		meta.setAuthor(crafter.getName());
	else
		meta.setAuthor("unknown");
	meta.setGeneration(Generation.TATTERED);
	meta.setLore(Arrays.asList(new String[]{ChatColor.GRAY + spell.getDescription(), ChatColor.GRAY + "Mana Cost: " + spell.getManaCost()}));
	// TODO Add description
	meta.addPage("-------------------=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
	i.setItemMeta(meta);
	return i;
}
 
开发者ID:mcardy,项目名称:MystiCraft,代码行数:17,代码来源:SpellTome.java

示例2: getSpellTome

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static ItemStack getSpellTome(Spell spell, User user) {
	ItemStack stack = new ItemStack(Material.WRITTEN_BOOK);
	BookMeta meta = (BookMeta) stack.getItemMeta();

	StringBuilder page = new StringBuilder();

	page.append("Spell: " + spell.getName() + "\n");
	page.append(spell.getDescription() + "\n");
	page.append("Mana Cost: " + spell.getManaCost());
	page.append("\n\n");
	page.append("Cast this spell with /cast " + WordUtils.capitalize(spell.getName()) + "\n\n");
	page.append("Learn this spell by left clicking the book");

	meta.setPages(page.toString());
	meta.setAuthor(user.<Player> getPlayer().getName());
	meta.setDisplayName(ChatColor.GOLD + "Spell Tome" + ChatColor.GRAY + SEPERATOR
			+ WordUtils.capitalize(spell.getName()));
	meta.setLore(Lists.newArrayList(ChatColor.GRAY + "Learn by left clicking"));
	stack.setItemMeta(meta);
	return stack;
}
 
开发者ID:mcardy,项目名称:Zephyr,代码行数:22,代码来源:SpellTome.java

示例3: getBook

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
/**
 * Get book
 * 
 * @param document
 * @return
 */
private ItemStack getBook(Document document)
{   
    ItemStack book = new ItemStack(Material.BOOK_AND_QUILL);
    
    BookMeta bookMeta = (BookMeta)book.getItemMeta();
    
    String id = document.getId();
    String author = (String)document.getPropertyValue(PropertyIds.CREATED_BY);
    String name = document.getName();
    
    ContentCraftPlugin.logger.info("Setting document meta-data - " + id + "," + name + "," + author);
    
    bookMeta.setDisplayName(name);        
    bookMeta.setAuthor(author);        
    bookMeta.setLocalizedName(id);
    
    String content = CommonUtil.getContentAsString(document.getContentStream());  
    List<String> pages = CommonUtil.split(content, 16, 265);
    bookMeta.setPages(pages);   
    
    book.setItemMeta(bookMeta);
    
    return book;
}
 
开发者ID:rwetherall,项目名称:ContentCraft,代码行数:31,代码来源:ChestListener.java

示例4: getWikiBook

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static ItemStack getWikiBook()
{
	ItemStack book = wikiBook.clone();
	BookMeta im = (BookMeta) book.getItemMeta();
	im.setDisplayName(MessageType.MENU_ENCYCLOPEDIA_NAME.getTranslation().getValue());
	im.setTitle(MessageType.MENU_ENCYCLOPEDIA_NAME.getTranslation().getValue());
	im.setAuthor(MessageType.MENU_ENCYCLOPEDIA_AUTHOR.getTranslation().getValue());
	book.setItemMeta(im);
	return book;
}
 
开发者ID:Limeth,项目名称:Breakpoint,代码行数:11,代码来源:InventoryMenuManager.java

示例5: getBook

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public final ItemStack getBook(String bookName) {
    List<String> bookPages = cm.getBookPages(bookName);
    ItemStack book = new ItemStack(Material.WRITTEN_BOOK, 1);
    BookMeta bm = (BookMeta) book.getItemMeta();
    bm.setDisplayName(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString(bookName + "-book.title")));
    bm.setAuthor(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString(bookName + "-book.author")));
    bm.setTitle(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString(bookName + "-book.title")));
    bm.setPages(bookPages);
    bm.addEnchant(Enchantment.LUCK, 1, true);
    book.setItemMeta(bm);
    return book;
}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:13,代码来源:PlayerManager.java

示例6: getHelpBook

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public ItemStack getHelpBook() {
    List<String> bookPages = new ArrayList<>();
    for (String page : lang.getConfigurationSection("help-book.pages").getKeys(false)) {
        try {
            Integer.parseInt(page);
        } catch (NumberFormatException ex) {
            continue;
        }
        String textPage = "";
        for (String line : lang.getConfigurationSection("help-book.pages." + page).getKeys(false)) {
            if (line != null) {
                String text = ChatColor.translateAlternateColorCodes('&', lang.getString("help-book.pages." + page + "." + line));
                textPage = textPage.concat(text).concat("\n");
            }
        }
        bookPages.add(textPage);
    }
    ItemStack book = new ItemStack(Material.WRITTEN_BOOK, 1);
    BookMeta bm = (BookMeta) book.getItemMeta();
    bm.setDisplayName(ChatColor.translateAlternateColorCodes('&', lang.getString("help-book.title")));
    bm.setAuthor(ChatColor.translateAlternateColorCodes('&', lang.getString("help-book.author")));
    bm.setTitle(ChatColor.translateAlternateColorCodes('&', lang.getString("help-book.title")));
    bm.setPages(bookPages);
    bm.addEnchant(Enchantment.LUCK, 1, true);
    book.setItemMeta(bm);
    return book;
}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:28,代码来源:LangManager.java

示例7: createSpellTome

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static ItemStack createSpellTome(Spell spell) {
	ItemStack item = new ItemStack(Material.WRITTEN_BOOK);
	BookMeta meta = (BookMeta) item.getItemMeta();
	meta.setDisplayName(Language.get("item.spelltome.name", ChatColor.GOLD + "SpellTome"));
	meta.setTitle(Language.get("item.spelltome.name", ChatColor.GOLD + "SpellTome"));
	meta.setLore(Arrays.asList(ChatColor.GRAY + WordUtils.capitalize(spell.getName())));
	meta.addPage(spell.getDescription()
			+ "\n\n"
			+ Language.get("item.spelltome.cast", "Cast this spell with " + ChatColor.DARK_AQUA + "/cast [SPELL]")
					.replace("[SPELL]", WordUtils.capitalize(spell.getName())) + "\n\n"
			+ Language.get("item.spelltome.learn", ChatColor.GRAY + "Learn this spell by left-clicking this book"));
	item.setItemMeta(meta);
	return item;
}
 
开发者ID:mcardy,项目名称:Zephyrus-II,代码行数:15,代码来源:SpellTome.java

示例8: addQuestJournal

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static void addQuestJournal(QuestPlayer qp) {
	if (!qp.getPlayer().isOnline()) {
		return;
	}
	if (!QuestManagerPlugin.questManagerPlugin.getPluginConfiguration()
			.getWorlds().contains(qp.getPlayer().getPlayer().getWorld().getName())) {
		return;
	}
	
	Player play = qp.getPlayer().getPlayer();
	Inventory inv = play.getInventory();
	
	if (inv.firstEmpty() == -1) {
		//no room!
		return;
	}
	
	ItemStack book = null;
	
	for (ItemStack item : inv.all(Material.BOOK_AND_QUILL).values()) {
		if (item.hasItemMeta()) {
			BookMeta meta = (BookMeta) item.getItemMeta();
			if (meta.hasTitle() && meta.getTitle().equals("Journal")
					&& meta.hasAuthor() && meta.getAuthor().equals(play.getName())
					&& item.getEnchantmentLevel(Enchantment.LUCK) == 5) {
				book = item;
				break;
			}
		}
	}
	
	if (book == null) {
	
		book = new ItemStack(Material.BOOK_AND_QUILL);
		BookMeta bookMeta = (BookMeta) book.getItemMeta();
		
		bookMeta.setTitle("Journal");
		bookMeta.setDisplayName("Journal");
		bookMeta.setAuthor(play.getName());
		
		book.setItemMeta(bookMeta);
		
		book.addUnsafeEnchantment(Enchantment.LUCK, 5);
		
		inv.addItem(book);
		
		play.sendMessage(ChatColor.GRAY + "A " + ChatColor.DARK_GREEN 
				+ "Quest Journal" + ChatColor.GRAY + " has been added to your inventory."
				 + ChatColor.RESET);
	}
	
	updateQuestJournal(qp, true);
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:54,代码来源:QuestJournal.java

示例9: applyLobbyInventory

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
/**
 * Apply lobby inventory.
 *
 * @param player the player
 */
@SuppressWarnings("deprecation")
public static void applyLobbyInventory(final Player player) {

    ItemStack[] contents = new ItemStack[36];
    ItemStack[] armor = new ItemStack[4];

    ItemStack bo = new ItemStack(Material.WRITTEN_BOOK);

    BookMeta im = (BookMeta) bo.getItemMeta();
    im.setDisplayName(Col.Green() + "Welcome To Super Sky Bros");
    im.setAuthor(Col.Gold() + "Relicum");
    im.setTitle(Col.Aqua() + "Super Sky Bros");
    List<String> page = new ArrayList<>();
    page.add(Col.Blue() + "Welcome to SuperSkyBros");
    page.add(Col.Blue() + "Please read for more details");
    String[] strpage = new String[page.size()];
    page.toArray(strpage);
    im.addPage(page.toArray(strpage));
    bo.setItemMeta(im);

    ItemStack em = new ItemStack(Material.EMERALD);
    ItemMeta iem = em.getItemMeta();
    iem.setDisplayName(Col.Green() + "Class Shop");
    List<String> lo = new ArrayList<>();
    lo.add(Col.Light_Purple() + "Not Currently Open");
    lo.add(Col.Light_Purple() + "Hope to be open soon");
    iem.setLore(lo);
    em.setItemMeta(iem);

    contents[0] = bo;
    contents[8] = em;

    player.getInventory().setContents(contents);
    player.getInventory().setArmorContents(armor);

    player.closeInventory();

    Bukkit.getServer().getScheduler().runTask(SkyApi.getSCB(), new Runnable() {

        @Override
        public void run() {
            player.updateInventory();
        }
    });


}
 
开发者ID:Relicum,项目名称:SuperSkyBros,代码行数:53,代码来源:PlayerDefaults.java

示例10: applyLobbyInv

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static Player applyLobbyInv(Player player) {


        ClearInventory.Clear(player);
        ItemStack bo = new ItemStack(Material.WRITTEN_BOOK);

        BookMeta im = (BookMeta) bo.getItemMeta();
        im.setDisplayName(Col.Green() + "Welcome To Super Sky Bros");
        im.setAuthor(Col.Gold() + "Relicum");
        im.setTitle(Col.Aqua() + "Super Sky Bros");
        List<String> page = new ArrayList<>();
        page.add(Col.Blue() + "Welcome to SuperSkyBros");
        page.add(Col.Blue() + "Please read for more details");
        String[] strpage = new String[page.size()];
        page.toArray(strpage);
        im.addPage(page.toArray(strpage));
        bo.setItemMeta(im);

        ItemStack em = new ItemStack(Material.EMERALD);
        ItemMeta iem = em.getItemMeta();
        iem.setDisplayName(Col.Green() + "Class Shop");
        List<String> lo = new ArrayList<>();
        lo.add(Col.Light_Purple() + "Not Currently Open");
        lo.add(Col.Light_Purple() + "Hope to be open soon");
        iem.setLore(lo);
        em.setItemMeta(iem);

        player.setMaximumNoDamageTicks(12000);
        player.setHealth(20.0D);
        player.setFoodLevel(20);
        player.setFlying(false);
        player.setAllowFlight(false);
        player.setLevel(0);
        player.setExp(0.0F);
        player.getInventory().setItem(0, bo);
        player.getInventory().setItem(8, em);
        if (player.getName().equalsIgnoreCase("Relicum")) {
            player.setDisplayName(Col.Dark_Purple() + "Relicum" + Col.Reset());
            player.setPlayerListName(Col.Dark_Purple() + "Relicum" + Col.Reset());
        } else {

            String pn = player.getName();
            int l = pn.length();
            String spn;
            if (l > 14) {
                spn = pn.substring(0, 13);

            } else {
                spn = pn;
            }
            player.setPlayerListName(Col.Grey() + spn + Col.Reset());
            player.setDisplayName(Col.Grey() + spn + Col.Reset());
        }
        UpdateInv(player);

        return player;
    }
 
开发者ID:Relicum,项目名称:SuperSkyBros,代码行数:58,代码来源:ClearInventory.java


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