本文整理汇总了Java中org.bukkit.Material.BOOK属性的典型用法代码示例。如果您正苦于以下问题:Java Material.BOOK属性的具体用法?Java Material.BOOK怎么用?Java Material.BOOK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.BOOK属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCommand
@Override
public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
if (arg0 instanceof Player) {
Player meowPlayer = (Player) arg0;
// Create a new ItemStack (type: diamond)
ItemStack rawFish = new ItemStack(Material.RAW_FISH);
// Create a new ItemStack (type: brick)
ItemStack book = new ItemStack(Material.BOOK);
// Set the amount of the ItemStack
book.setAmount(20);
// Give the player our items (comma-seperated list of all ItemStack)
meowPlayer.getInventory().addItem(book, rawFish);
} else {
getLogger().info("hai nun human!");
}
// If the player (or console) uses our command correct, we can return true
return true;
}
示例2: onCommand
@Override
public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
if (arg0 instanceof Player) {
Player meowPlayer = (Player) arg0;
// Create a new ItemStack (type: brick)
ItemStack book = new ItemStack(Material.BOOK);
// Set the amount of the ItemStack
book.setAmount(1);
// Give the player our items (comma-seperated list of all ItemStack)
meowPlayer.getInventory().addItem(book);
}
// Code for the Book -> setAuthor(String "Unknown");
// If the player (or console) uses our command correct, we can return true
return true;
}
示例3: rightClick
@EventHandler
public void rightClick(PlayerInteractEntityEvent e)
{
if (!(e.getRightClicked() instanceof Player)) {
return;
}
Player player = e.getPlayer();
Player p = (Player)e.getRightClicked();
if ((modMode.contains(player.getName())) && ((p instanceof Player)) && ((player instanceof Player)) && (player.getItemInHand().getType() == Material.BOOK)) {
player.openInventory(p.getInventory());
player.sendMessage(ChatColor.GRAY + " §6§ §rNow opening the inventory of §e" + p.getName() + ChatColor.GRAY + "§r.");
}
else if ((modMode.contains(player.getName())) && ((p instanceof Player)) && ((player instanceof Player)) && (player.getItemInHand().getType() == Material.PACKED_ICE)) {
player.sendMessage(ChatColor.GRAY + " §6§ §rAttempting to freeze §e"+ p.getName() + "§r.");
player.chat("/ss " + p.getName());
}
}
示例4: openStatsGUI
public void openStatsGUI(Player p){
inv = Bukkit.createInventory(null, 27, ChatColor.DARK_GRAY + "Stats");
/*List<String> armamentLore = new ArrayList();
armamentLore.add(ChatColor.BLUE + "Level: "+ ChatColor.GREEN + getArmamentHakiLevel(p.getName()));
armamentLore.add(ChatColor.BLUE + "XP: " + ChatColor.GREEN + getArmamentHakiXP(p.getName()));
armamentLore.add(ChatColor.BLUE + "XP Needed: " + ChatColor.GREEN + ((armamentHakiLevels[getArmamentHakiLevel(p.getName()) + 1])- (getArmamentHakiXP(p.getName()))));
List<String> observationLore = new ArrayList();
observationLore.add(ChatColor.BLUE + "Level: "+ ChatColor.GREEN + getObservationHakiLevel(p.getName()));
observationLore.add(ChatColor.BLUE + "XP: " + ChatColor.GREEN + getObservationHakiXP(p.getName()));
observationLore.add(ChatColor.BLUE + "XP Needed: " + ChatColor.GREEN + ((armamentHakiLevels[getObservationHakiLevel(p.getName()) + 1])- (getObservationHakiXP(p.getName()))));
List<String> conquerorLore = new ArrayList();
conquerorLore.add(ChatColor.BLUE + "Level: "+ ChatColor.GREEN + getConquerorHakiLevel(p.getName()));
conquerorLore.add(ChatColor.BLUE + "XP: " + ChatColor.GREEN + getConquerorHakiXP(p.getName()));
conquerorLore.add(ChatColor.BLUE + "XP Needed: " + ChatColor.GREEN + ((armamentHakiLevels[getConquerorHakiLevel(p.getName()) + 1])- (getConquerorHakiXP(p.getName()))));
*/
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
ItemStack className = new ItemStack(Material.BOOK);
ItemMeta classNameMeta = className.getItemMeta();
ItemStack kills = new ItemStack(Material.IRON_SWORD);
ItemMeta killsMeta = kills.getItemMeta();
ItemStack deaths = new ItemStack(Material.BONE);
ItemMeta deathsMeta = deaths.getItemMeta();
ItemStack armament = new ItemStack(Material.IRON_INGOT);
ItemMeta armamentMeta = armament.getItemMeta();
ItemStack observation = new ItemStack(Material.NETHER_STAR);
ItemMeta observationMeta = observation.getItemMeta();
ItemStack conqueror = new ItemStack(Material.BLAZE_ROD);
ItemMeta conquerorMeta = observation.getItemMeta();
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
skullMeta.setOwner(p.getName());
skullMeta.setDisplayName(ChatColor.GOLD + p.getName() + "'s Stats");
skull.setItemMeta(skullMeta);
classNameMeta.setDisplayName(ChatColor.GOLD + "Class: " + ChatColor.BLUE + Datafiles.getClass(p.getName()));
className.setItemMeta(classNameMeta);
killsMeta.setDisplayName(ChatColor.GOLD + "Kills: " + ChatColor.BLUE + Datafiles.getKills(p.getName()));
kills.setItemMeta(killsMeta);
deathsMeta.setDisplayName(ChatColor.GOLD + "Deaths: " + ChatColor.BLUE + Datafiles.getDeaths(p.getName()));
deaths.setItemMeta(deathsMeta);
armamentMeta.setDisplayName(ChatColor.GOLD + "Armament Haki");
// armamentMeta.setLore(armamentLore);
armament.setItemMeta(armamentMeta);
observationMeta.setDisplayName(ChatColor.GOLD + "Observation Haki");
//observationMeta.setLore(observationLore);
observation.setItemMeta(observationMeta);
conquerorMeta.setDisplayName(ChatColor.GOLD + "Conqueror Haki");
// conquerorMeta.setLore(conquerorLore);
conqueror.setItemMeta(conquerorMeta);
inv.setItem(0, skull);
inv.setItem(9, className);
inv.setItem(4, kills);
inv.setItem(13, deaths);
inv.setItem(8, armament);
inv.setItem(17, observation);
inv.setItem(26, conqueror);
p.openInventory(inv);
}
示例5: modItems
public static void modItems(Player p)
{
Inventory inv = p.getInventory();
inv.clear();
ItemStack modCompass = new ItemStack(Material.COMPASS);
ItemStack modBook = new ItemStack(Material.BOOK);
ItemStack modFreeze = new ItemStack(Material.PACKED_ICE);
ItemStack modTp = new ItemStack(Material.EYE_OF_ENDER);
ItemStack modVanish = new ItemStack(Material.FEATHER);
ItemMeta compassMeta = modCompass.getItemMeta();
ItemMeta bookMeta = modBook.getItemMeta();
ItemMeta freezeMeta = modFreeze.getItemMeta();
ItemMeta tpMeta = modTp.getItemMeta();
ItemMeta vanishMeta = modVanish.getItemMeta();
compassMeta.setDisplayName("§cWhoosh");
bookMeta.setDisplayName("§cInspect Player");
freezeMeta.setDisplayName("§cFreeze Player");
vanishMeta.setDisplayName("§cToggle Vanish");
tpMeta.setDisplayName("§cRandom Teleporter");
ArrayList<String> modCompassLore = new ArrayList();
ArrayList<String> modBookLore = new ArrayList();
ArrayList<String> modFreezeLore = new ArrayList();
ArrayList<String> modVanishLore = new ArrayList();
ArrayList<String> modTpLore = new ArrayList();
modCompassLore.add("§7Used to teleport to eye location.");
modBookLore.add("§7Used to inspect a players inventory.");
modFreezeLore.add("§7Used to freeze a player.");
modVanishLore.add("§7Used to toggle vanish.");
modTpLore.add("§7Used to teleport to a random player.");
compassMeta.setLore(modCompassLore);
bookMeta.setLore(modBookLore);
freezeMeta.setLore(modFreezeLore);
vanishMeta.setLore(modVanishLore);
tpMeta.setLore(modTpLore);
modCompass.setItemMeta(compassMeta);
modBook.setItemMeta(bookMeta);
modFreeze.setItemMeta(freezeMeta);
modTp.setItemMeta(tpMeta);
modVanish.setItemMeta(vanishMeta);
inv.setItem(0, modCompass);
inv.setItem(3, modVanish);
inv.setItem(4, modBook);
inv.setItem(5, modFreeze);
inv.setItem(8, modTp);
}