本文整理汇总了Java中org.bukkit.Material.EYE_OF_ENDER属性的典型用法代码示例。如果您正苦于以下问题:Java Material.EYE_OF_ENDER属性的具体用法?Java Material.EYE_OF_ENDER怎么用?Java Material.EYE_OF_ENDER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.EYE_OF_ENDER属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isInteractableItem
/**
* checks if this item is interactable
*/
public static boolean isInteractableItem(ItemStack item) {
if (item == null || item.getType() == Material.AIR) {
return false;
}
if (item.getType().isBlock()) {
return true;
}
if (item.getType() == Material.REDSTONE || item.getType() == Material.WATER_BUCKET || item.getType() == Material.LAVA_BUCKET) {
return true;
}
if (item.getType() == Material.MONSTER_EGG) {
return true;
}
if (item.getType() == Material.EGG || item.getType() == Material.SNOW_BALL || item.getType() == Material.BOW || item.getType() == Material.ENDER_PEARL || item.getType() == Material.EYE_OF_ENDER || item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION || item.getType() == Material.EXP_BOTTLE || item.getType() == Material.FIREWORK_CHARGE) {
return true;
}
if (item.getType().isEdible()) {
return true;
}
return false;
}
示例2: onRecord
@EventHandler
public void onRecord(PlayerInteractEvent e)
{
Player p = e.getPlayer();
if ((modMode.contains(p.getName())) && (p.getItemInHand().getType() == Material.EYE_OF_ENDER) && (e.getAction().toString().contains("RIGHT")))
{
Player random = Bukkit.getOnlinePlayers()[new java.util.Random().nextInt(Bukkit.getOnlinePlayers().length)];
if (Bukkit.getOnlinePlayers().length == 1)
p.sendMessage(ChatColor.RED + "§6§ §rOops, seems like there are not enough players to use this.");
e.setCancelled(true);
if (Bukkit.getOnlinePlayers().length > 1) {
if (p != random) {
p.teleport(random);
p.sendMessage(ChatColor.YELLOW + " §6§ §rYou were teleported randomly to §c" + random.getName() + "§r.");
e.setCancelled(true);
}
if (p == random) {
p.sendMessage(ChatColor.YELLOW + "§6§ §rOops, seems like we accidently found you. Please try again!");
e.setCancelled(true);
}
}
}
}
示例3: getIcon
@Override
public ItemStack getIcon()
{
return new ItemStack(Material.EYE_OF_ENDER, 1);
}
示例4: 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);
}