本文整理汇总了Java中org.bukkit.inventory.meta.BookMeta.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java BookMeta.setTitle方法的具体用法?Java BookMeta.setTitle怎么用?Java BookMeta.setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.inventory.meta.BookMeta
的用法示例。
在下文中一共展示了BookMeta.setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: CustomBookOverlay
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public CustomBookOverlay(String title, String author, TellRawMessage... pages) {
this.book = new ItemStack(Material.WRITTEN_BOOK);
BookMeta meta = (BookMeta) this.book.getItemMeta();
meta.setTitle(title);
meta.setAuthor(author);
for (TellRawMessage page: pages) {
try {
addPage(meta, page);
} catch (Exception e) {
e.printStackTrace();
}
}
this.book.setItemMeta(meta);
}
示例3: setbooktitle
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
@SubCommand(value = "setbooktitle", permission = "nu.setbook")
public void setbooktitle(CommandSender sender, Arguments args) {
if (!(args.length() > 1)) {
msg(sender, "manual.setbooktitle.usage");
return;
}
String title = args.next();
Player p = asPlayer(sender);
title = ChatColor.translateAlternateColorCodes('&', title);
ItemStack item = p.getInventory().getItemInMainHand();
if (item == null || !item.getType().equals(Material.WRITTEN_BOOK)) {
msg(sender, "user.setbook.no_book");
return;
}
BookMeta meta = (BookMeta) item.getItemMeta();
meta.setTitle(title);
item.setItemMeta(meta);
msg(sender, "user.setbook.success");
}
示例4: sendBook
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
private void sendBook( CommandSender sender, String title, List<String> pages ) {
if ( !(sender instanceof Player) ) {
sender.sendMessage( ChatColor.YELLOW + "We are unable to give you a debug book. :(" );
return;
}
pages = pages.stream().map( page -> ChatColor.translateAlternateColorCodes( '&', page ) ).collect( Collectors.toList() );
ItemStack is = new ItemStack( Material.WRITTEN_BOOK, 1 );
BookMeta bookMeta = ((BookMeta) is.getItemMeta());
bookMeta.setAuthor( ChatColor.GREEN.toString() + ChatColor.BOLD + "Minecraftly" );
bookMeta.setTitle( ChatColor.GOLD.toString() + ChatColor.BOLD + "Debugging Book || " + title );
bookMeta.setGeneration( BookMeta.Generation.ORIGINAL );
bookMeta.setPages( pages );
is.setItemMeta( bookMeta );
Player player = ((Player) sender);
player.getWorld().dropItem( player.getLocation().add( 0, 1, 0 ), is );
player.playSound( player.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1, 1 );
}
示例5: apply
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
@Override
public boolean apply(ItemStack itemStack, ItemMetaValue meta) {
PreCon.notNull(itemStack);
PreCon.notNull(meta);
ItemMeta itemMeta = itemStack.getItemMeta();
if (!(itemMeta instanceof BookMeta))
return false;
BookMeta bookMeta = (BookMeta)itemMeta;
bookMeta.setTitle(meta.getRawData());
itemStack.setItemMeta(bookMeta);
return true;
}
示例6: UpgradeItem
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public UpgradeItem(SQTechDrill plugin)
{
this.main = plugin;
upgradeItem = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bookMeta = (BookMeta) upgradeItem.getItemMeta();
//bookMeta.setDisplayName(ChatColor.BLUE + "" + ChatColor.ITALIC + "Drill Upgrade");
bookMeta.setAuthor(ChatColor.AQUA + "Drill");
bookMeta.setPages("Test pgae 1\n s","asgsgge 2");
bookMeta.setGeneration(BookMeta.Generation.ORIGINAL);
bookMeta.setTitle(ChatColor.BLUE + "" + ChatColor.ITALIC + "Drill Upgrade");
upgradeItem.setItemMeta(bookMeta);
ShapelessRecipe recipe = new ShapelessRecipe(upgradeItem);
//TODO temp recipe
recipe.addIngredient(Material.DIRT); //Adds the specified ingredient.
main.getServer().addRecipe(recipe);
}
示例7: getTP
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
private boolean getTP(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
if (sender.hasPermission("cpu.command.gettp")) {
Player player = (Player) sender;
Location location = player.getLocation();
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bookMeta = (BookMeta) book.getItemMeta();
bookMeta.setTitle("Destination");
bookMeta.setPages(Arrays.asList(location.getWorld().getName() + " " + location.getX() + " " + location.getY() + " " + location.getZ() + " " + location.getYaw() + " " + location.getPitch()));
book.setItemMeta(bookMeta);
player.getInventory().addItem(book);
return true;
}
sender.sendMessage(ChatColor.RED + "[CPU] You do not have enough permission to run this command!");
return true;
}
sender.sendMessage(ChatColor.RED + "[CPU] Only players can get the teleport coordinates!");
return true;
}
示例8: giveItem
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的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);
}
示例9: MythicTome
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
/**
* Instantiates a new MythicTome with a specified {@link MaterialData} of a {@link TomeType}. It is also
* instantiated with a specified title and author, specified lore and pages.
*
* @param tomeType Type of tome to create
* @param title Name of the tome
* @param author Author of the tome
* @param lore Lore of the tome
* @param pages Pages for the tome
*/
public MythicTome(TomeType tomeType, String title, String author, List<String> lore,
String[] pages) {
super(tomeType.toMaterial());
ItemMeta itemMeta = getItemMeta();
List<String> coloredLore = new ArrayList<>();
for (String s : lore) {
coloredLore.add(s.replace('&', '\u00A7').replace("\u00A7\u00A7", "&"));
}
if (itemMeta instanceof BookMeta) {
BookMeta bookMeta = (BookMeta) itemMeta;
bookMeta.setTitle(title.replace('&', '\u00A7').replace("\u00A7\u00A7", "&"));
bookMeta.setAuthor(author);
bookMeta.setLore(coloredLore);
bookMeta.setPages(pages);
setItemMeta(bookMeta);
} else {
itemMeta.setDisplayName(title.replace('&', '\u00A7').replace("\u00A7\u00A7", "&"));
itemMeta.setLore(coloredLore);
setItemMeta(itemMeta);
}
setAmount(1);
}
示例10: generateBook
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static ItemStack generateBook(String title, String author, List<String> pages) {
ItemStack stack = new ItemStack(Material.WRITTEN_BOOK);
BookMeta meta = (BookMeta) factory.getItemMeta(Material.WRITTEN_BOOK);
meta.setTitle(title);
meta.setAuthor(author);
meta.setPages(pages);
stack.setItemMeta(meta);
return stack;
}
示例11: create
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
public static ItemStack create(ItemStack item, String name) {
if (!(item.getItemMeta() instanceof BookMeta)) {
return null;
}
BookMeta meta = (BookMeta) item.getItemMeta();
meta.setAuthor(name);
meta.setTitle(meta.getTitle());
meta.setLore(Arrays.asList(FMessage.BULL_ID.getMessage(), FMessage.BULL_RIGHT_KLICK.getMessage()));
meta.setGeneration(Generation.ORIGINAL);
ItemStack bull = new ItemStack(Material.WRITTEN_BOOK);
bull.setItemMeta(meta);
return bull;
}
示例12: 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;
}
示例13: get
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
@Override
protected ItemStack[] get(Event event) {
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
BookMeta meta = (BookMeta) book.getItemMeta();
meta.setTitle(title.getSingle(event));
meta.setAuthor(author.getSingle(event));
meta.setPages(texts.getArray(event));
book.setItemMeta(meta);
return new ItemStack[]{book};
}
示例14: 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;
}
示例15: change
import org.bukkit.inventory.meta.BookMeta; //导入方法依赖的package包/类
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
BookMeta book = (BookMeta) item.getSingle(e).getItemMeta();
if (mode == ChangeMode.SET) {
book.setTitle((String)delta[0]);
}
item.getSingle(e).setItemMeta(book);
}