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


Java BookMeta.addPage方法代码示例

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


在下文中一共展示了BookMeta.addPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createBook

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static ItemStack createBook(String name, List<String> lore, String... pages) {
    ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
    BookMeta meta = (BookMeta) book.getItemMeta();
    ItemMeta bookMeta = book.getItemMeta();

    bookMeta.setDisplayName(Utils.colorize(name));
    ArrayList<String> colorLore = new ArrayList<>();
    if (lore != null) lore.forEach(str -> colorLore.add(Utils.colorize(str)));
    bookMeta.setLore(colorLore);

    meta.addPage(pages);
    meta.setAuthor(Utils.colorize("&6ProjectAlpha"));

    book.setItemMeta(bookMeta);

    return book;
}
 
开发者ID:cadox8,项目名称:PA,代码行数:18,代码来源:ItemUtil.java

示例3: parseBook

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static BookMeta parseBook(Element xml, BookMeta source) {
    Element book = xml.getChild("book");
    if (book != null) {
        Attribute author = book.getAttribute("author");
        if (author != null) {
            source.setAuthor(parseMessage(author.getValue()));
        }

        Attribute title = book.getAttribute("title");
        if (title != null) {
            source.setTitle(parseMessage(title.getValue()));
        }

        for (Element page : book.getChildren("page")) {
            source.addPage(parseMessage(page.getTextNormalize()));
        }
    }

    return source;
}
 
开发者ID:ShootGame,项目名称:Arcade2,代码行数:21,代码来源:XMLItemMeta.java

示例4: linePageinate

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static void linePageinate(BookMeta meta, ArrayList<String> lines) {
	/*
	 * 13 writeable lines per page, iterate through each line
	 * and place into the page, when the line count equals 14
	 * set it back to 0 and add page.
	 */
	
	int count = 0;
	String page = "";
	for (String line : lines) {
		count++;
		if (count > LINES_PER_PAGE) {
			meta.addPage(page);
			count = 0;
			page = "";
		}
		page += line+"\n";			
	}
	
	meta.addPage(page);
}
 
开发者ID:netizen539,项目名称:civcraft,代码行数:22,代码来源:BookUtil.java

示例5: writeBook

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
/**
 * 「逃走中」というタイトルの本に対してページを追加できます。<br>
 * 汎用性をあげるために、権限による分別はしていません。(この本を持っている人のみが対象。逃走者以外でも可)
 *     
 * @param msg ミッション告知用の本「逃走中」に追加するページ内容
 */
public void writeBook(String msg) {
    for (Player player : Bukkit.getServer().getOnlinePlayers()) {
        for (ItemStack item : player.getInventory().getContents()) {
            if (item != null) {
                if (item.getType().equals(Material.WRITTEN_BOOK)) {
                    BookMeta meta = (BookMeta) item.getItemMeta();
                    if (meta.getTitle().equals("逃走中")) {
                        meta.addPage(msg);
                        item.setItemMeta(meta);
                    }
                }
            }
        }
    }
}
 
开发者ID:pekomiya,项目名称:TosoGame3,代码行数:22,代码来源:BookAPI.java

示例6: constructBook

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static ItemStack constructBook(ItemStack item, String title, String owner, String[] pages)
{
    if (item.getItemMeta() instanceof BookMeta)
    {
        BookMeta meta = (BookMeta)item.getItemMeta();
        if (title != null)
            meta.setTitle(title);
        if (owner != null)
            meta.setAuthor(owner);
        if (pages != null)
            meta.addPage(pages);
        item.setItemMeta(meta);
    }
    return item;
}
 
开发者ID:SamaGames,项目名称:AgarMC,代码行数:16,代码来源:Utils.java

示例7: execute

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
@Override
protected void execute(Event e) {
	if (book == null) return;
	if (book.getSingle(e).getType() == Material.BOOK_AND_QUILL || book.getSingle(e).getType() == Material.WRITTEN_BOOK) {
		BookMeta bookMeta = (BookMeta) book.getSingle(e).getItemMeta();
		if (string != null) {
			bookMeta.addPage(string.getSingle(e));
		} else {
			bookMeta.addPage();
		}
		book.getSingle(e).setItemMeta(bookMeta);
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:14,代码来源:EffAddPage.java

示例8: 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

示例9: execute

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
@Override
public void execute(
        final ConfigurableCommand command,
        final Plugin plugin,
        final CommandSender sender,
        final String[] args) {

    if (!(sender instanceof Player)) {
        command.sendMessage(sender, NOT_PLAYER, "&4You must be a player to use this command");
        return;
    }

    final ItemStack book = new ItemStack(Material.BOOK_AND_QUILL);
    final BookMeta meta = (BookMeta)book.getItemMeta();
    meta.addPage("EnchantmentAPI\nBy Eniripsa96\n\n Enchantment details");
    meta.setAuthor("Eniripsa96");
    meta.setTitle("EnchantmentAPI");

    final ArrayList<CustomEnchantment> enchants = new ArrayList<>(EnchantmentAPI.getRegisteredEnchantments());
    Collections.sort(enchants);

    for (final CustomEnchantment enchantment : enchants) {
        if (enchantment instanceof VanillaEnchantment) continue;
        if (enchantment.getDescription() == null) continue;
        StringBuilder page = new StringBuilder();
        page.append(enchantment.getName()).append(" - ").append(enchantment.getDescription()).append("\n\nItems: ");

        boolean first = true;
        for (Material item : enchantment.getNaturalItems()) {
            if (first) first = false;
            else page.append(", ");
            page.append(ItemManager.getVanillaName(item));
        }
        if (first) page.append("None");
        meta.addPage(page.toString());
    }
    book.setItemMeta(meta);
    ((Player)sender).getInventory().addItem(book);
    command.sendMessage(sender, SUCCESS, "&2You have received a book with all enchantment details");
}
 
开发者ID:Eniripsa96,项目名称:EnchantmentAPI,代码行数:41,代码来源:CmdBook.java

示例10: ItemStuffer

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
/**
 * Generate common stuff data.
 */
public ItemStuffer()
{
	String[] mpages = new String[] {
			  "\n\n\n\n\n\n�c = BOUC-EMISSAIRE =\n   -R�gles du jeu-\n           -o-",
			  "�cBut du jeu:�0\nEtre le dernier joueur vivant.\n\n"
			+ "�cBouc-�missaire:�0\nChaque meurtrier devient bouc-�missaire.\n\n"
			+ "�cTP:�0\nUn joueur tir� au sort est TP au bouc-�missaire.",
			  "�c/!\\ TRICHE�0\n\nToute prise en flagrant d�lit de triche quelconque :"
			+ "\n\n- X-Ray\n- FlyHack\n- etc.\n\nest punie d'un ban �4permanent�0 et �4irr�versible�0.",
			  "�cCOMMANDES:�0\n\n�c/votemap�0\nDemander un changement de map au lieu de commencer la partie.",
			  "\n\n\n\n\n\n   �5 Bonne chance !",
			  };

	String[] mpages_bonus = new String[] {
			"\n\n\n\n\n\n       Ne pas lire\n        plus loin\n             ...",
			"\n\n\n\n\n\n       The game.\n\n (On t'avait pr�venu)",
			};

	manual = new ItemStack(Material.WRITTEN_BOOK);
	
	BookMeta bmeta = (BookMeta) manual.getItemMeta();
	bmeta.setAuthor("�6E�flarcis");
	bmeta.setTitle(MANUAL_TITLE);
	bmeta.addPage(mpages);
	
	manual.setItemMeta(bmeta);

	bmeta.addPage(mpages_bonus);
	
	manual_bonus = new ItemStack(manual);
	manual_bonus.setItemMeta(bmeta);

	spectating_compass = new ItemStack(Material.COMPASS);
	
	ItemMeta cMeta = spectating_compass.getItemMeta();
	cMeta.setDisplayName(ChatColor.BLUE + "Menu spectateur");
	
	spectating_compass.setItemMeta(cMeta);
}
 
开发者ID:Elarcis,项目名称:Scapegoat,代码行数:43,代码来源:ItemStuffer.java

示例11: saveToBook

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static void saveToBook(BookMeta meta, String data, String dataTitle) {
	int max;
	int pageMax = 255 - _dataPre.length();
	for (int i = 0, l = data.length(); i < l; i += max) {
		max = (i == 0 ? pageMax - dataTitle.length() : pageMax);
		meta.addPage((i == 0 ? dataTitle : "") + _dataPre + data.substring(i, (i + max > l ? l : i + max)));
	}
}
 
开发者ID:goncalomb,项目名称:NBTEditor,代码行数:9,代码来源:BookSerialize.java

示例12: getSpelltome

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static ItemStack getSpelltome(ISpell spell) {
	ItemStack i = new ItemStack(Material.BOOK);
	BookMeta m = (BookMeta) i.getItemMeta();
	List<String> l = new ArrayList<String>();
	l.add(ChatColor.GRAY + "" + spell);
	m.setLore(l);
	m.setTitle(spell.getDisplayName());
	m.addPage(spell.getDesc() + "\n\n" + Lang.get("spelltome.cast").replace("[SPELL]", spell.getDisplayName())
			+ "\n\n" + Lang.get("spelltome.learn"));
	i.setItemMeta(m);
	i.addEnchantment(Zephyrus.getInstance().glow, 1);
	return i;
}
 
开发者ID:mcardy,项目名称:Zephyrus,代码行数:14,代码来源:SpellTome.java

示例13: createItem

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public void createItem(ItemStack i) {
	setItemName(i, this.name());
	BookMeta m = (BookMeta) i.getItemMeta();
	List<String> l = new ArrayList<String>();
	l.add(ChatColor.GRAY + "" + spell);
	m.setLore(l);
	m.setTitle(spell);
	m.addPage(desc + "\n\n" + Lang.get("spelltome.cast").replace("[SPELL]", spell) + "\n\n"
			+ Lang.get("spelltome.learn"));
	i.setItemMeta(m);
	setGlow(i);
}
 
开发者ID:mcardy,项目名称:Zephyrus,代码行数:13,代码来源:SpellTome.java

示例14: getAsItem

import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
/**
 * Generates the journal as ItemStack
 * 
 * @return the journal ItemStack
 */
public ItemStack getAsItem() {
	// create the book with default title/author
	ItemStack item = new ItemStack(Material.WRITTEN_BOOK);
	BookMeta meta = (BookMeta) item.getItemMeta();
	meta.setTitle(Config.getMessage(lang, "journal_title").replaceAll("&", "§"));
	meta.setAuthor(PlayerConverter.getPlayer(playerID).getName());
	List<String> lore = new ArrayList<String>();
	lore.add(Config.getMessage(lang, "journal_lore").replaceAll("&", "§"));
	meta.setLore(lore);
	// add main page and generate pages from texts
	List<String> finalList = new ArrayList<>();
	if (Config.getString("config.journal.one_entry_per_page").equalsIgnoreCase("false")) {
		String color = Config.getString("config.journal_colors.line");
		StringBuilder stringBuilder = new StringBuilder();
		for (String entry : getText()) {
			stringBuilder.append(entry + "\n§" + color + "---------------\n");
		}
		if (mainPage != null && mainPage.length() > 0) {
			if (Config.getString("config.journal.full_main_page").equalsIgnoreCase("true")) {
				finalList.addAll(Utils.pagesFromString(mainPage));
			} else {
				stringBuilder.insert(0, mainPage + "\n§" + color + "---------------\n");
			}
		}
		String wholeString = stringBuilder.toString().trim();
		finalList.addAll(Utils.pagesFromString(wholeString));
	} else {
		if (mainPage != null && mainPage.length() > 0) {
			finalList.addAll(Utils.pagesFromString(mainPage));
		}
		finalList.addAll(getText());
	}
	if (finalList.size() > 0) {
		meta.setPages(finalList);
	} else {
		meta.addPage("");
	}
	item.setItemMeta(meta);
	return item;
}
 
开发者ID:Co0sh,项目名称:BetonQuest,代码行数:46,代码来源:Journal.java

示例15: 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


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