本文整理汇总了Java中org.bukkit.Material.SIGN属性的典型用法代码示例。如果您正苦于以下问题:Java Material.SIGN属性的具体用法?Java Material.SIGN怎么用?Java Material.SIGN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.SIGN属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onProjectileHit
@EventHandler
public void onProjectileHit(ProjectileHitEvent event)
{
if (event.getEntity().getType() != EntityType.SNOWBALL || !event.getEntity().hasMetadata("paintball-ball") || !event.getEntity().getMetadata("paintball-ball").get(0).asString().equals(this.uuid.toString()))
return;
for (Block block : getNearbyBlocks(event.getEntity().getLocation(), 2))
{
if (block.getType() == Material.AIR || block.getType() == Material.SIGN || block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
continue;
if (this.isBlockGloballyUsed(block.getLocation()))
continue;
SimpleBlock simpleBlock = new SimpleBlock(Material.STAINED_CLAY, DyeColor.values()[new Random().nextInt(DyeColor.values().length)].getWoolData());
this.addBlockToUse(block.getLocation(), simpleBlock);
block.setType(simpleBlock.getType());
block.setData(simpleBlock.getData());
}
event.getEntity().remove();
}
示例2: onBlockBreak
@EventHandler(ignoreCancelled=true, priority=EventPriority.HIGHEST)
public void onBlockBreak(BlockBreakEvent event)
{
Block block = event.getBlock();
if (isEventSign(block))
{
BlockState state = block.getState();
Sign sign = (Sign)state;
ItemStack stack = new ItemStack(Material.SIGN, 1);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(EVENT_SIGN_ITEM_NAME);
meta.setLore(Arrays.asList(sign.getLines()));
stack.setItemMeta(meta);
Player player = event.getPlayer();
World world = player.getWorld();
Location blockLocation = block.getLocation();
if ((player.getGameMode() != GameMode.CREATIVE) && (world.isGameRule("doTileDrops"))) {
world.dropItemNaturally(blockLocation, stack);
}
event.setCancelled(true);
block.setType(Material.AIR);
state.update();
}
}
示例3: onPlayerInteractEvent
@EventHandler
public void onPlayerInteractEvent(PlayerInteractEvent event)
{
if (event.getClickedBlock() != null)
{
Material material = event.getClickedBlock().getType();
if (material == Material.SIGN || material == Material.SIGN_POST || material == Material.WALL_SIGN)
{
Sign sign = (Sign) event.getClickedBlock().getState();
if (sign.hasMetadata("game") && sign.hasMetadata("map"))
{
AbstractGame game = this.hub.getGameManager().getGameByIdentifier(sign.getMetadata("game").get(0).asString());
GameSign gameSign = game.getGameSignsByMap(sign.getMetadata("map").get(0).asString()).get(0);
if (SamaGamesAPI.get().getPermissionsManager().hasPermission(event.getPlayer(), "hub.debug.sign") && event.getPlayer().isSneaking())
{
gameSign.developperClick(event.getPlayer());
return;
}
gameSign.click(event.getPlayer());
}
}
else if (material == Material.SKULL)
{
Optional<AbstractGame> optional = this.hub.getGameManager().getGames().values().stream().filter(game -> game.getWebsiteDescriptionSkull().getBlock().getLocation().equals(event.getClickedBlock().getLocation())).findAny();
if (optional.isPresent() && optional.get().getWebsiteDescriptionURL() != null)
optional.get().showRulesWarning(event.getPlayer());
}
}
}
示例4: getKitSign
public Sign getKitSign(Sign s) {
for (Block b : kitSigns)
if (b.getX() == s.getX() && b.getY() == s.getY() && b.getZ() == s.getZ())
if (b.getType() == Material.SIGN || b.getType() == Material.WALL_SIGN)
return (Sign) b.getState();
return null;
}
示例5: getEventSign
public static ItemStack getEventSign(String playerName, String kothName)
{
ItemStack stack = new ItemStack(Material.SIGN, 1);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(EVENT_SIGN_ITEM_NAME);
meta.setLore(Lists.newArrayList(new String[] { ChatColor.GOLD + playerName, ChatColor.DARK_PURPLE + "captured by", ChatColor.GOLD + kothName,
DateTimeFormats.DAY_MTH_HR_MIN_SECS.format(System.currentTimeMillis()) }));
stack.setItemMeta(meta);
return stack;
}
示例6: newInventory
public static void newInventory(CommandSender sender) {
Inventory tpmenu = Bukkit.createInventory(null, 54, ChatColor.DARK_GRAY + "Teleport Menu - Page 1");
ItemStack empty = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
ItemMeta emptyMeta = empty.getItemMeta();
emptyMeta.setDisplayName(" ");
empty.setItemMeta(emptyMeta);
ItemStack close = new ItemStack(Material.BARRIER);
ItemStack nextpage = new ItemStack(Material.SIGN);
ItemStack previouspage = new ItemStack(Material.SIGN);
ItemMeta npMeta = nextpage.getItemMeta();
ItemMeta ppMeta = previouspage.getItemMeta();
ItemMeta closeMeta = close.getItemMeta();
closeMeta.setDisplayName(ChatColor.RED + "Close the menu.");
npMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Next Page");
ppMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Previous Page");
for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
ItemStack skulls = new ItemStack(Material.SKULL_ITEM, 1,(byte) 3);
SkullMeta skullsMeta = (SkullMeta) skulls.getItemMeta();
skullsMeta.setDisplayName(ChatColor.YELLOW + "Teleport to " + ChatColor.GREEN + targetPlayer.getName());
skullsMeta.setOwner(targetPlayer.getName());
skulls.setItemMeta(skullsMeta);
int beginningSlot = 9;
tpmenu.setItem(i+beginningSlot, skulls);
}
tpmenu.setItem(0, empty);
tpmenu.setItem(1, empty);
tpmenu.setItem(2, empty);
tpmenu.setItem(3, empty);
tpmenu.setItem(4, empty);
tpmenu.setItem(5, empty);
tpmenu.setItem(6, empty);
tpmenu.setItem(7, empty);
tpmenu.setItem(8, empty);
tpmenu.setItem(45, empty);
tpmenu.setItem(46, empty);
tpmenu.setItem(47, empty);
tpmenu.setItem(48, empty);
tpmenu.setItem(49, close);
tpmenu.setItem(50, empty);
tpmenu.setItem(51, empty);
tpmenu.setItem(52, empty);
tpmenu.setItem(53, nextpage);
((HumanEntity) sender).openInventory(tpmenu);
}
示例7: newInventory
public static void newInventory(CommandSender sender) {
Inventory tpheremenu = Bukkit.createInventory(null, 54, ChatColor.DARK_GRAY + "Teleport Here Menu - Page 1");
ItemStack empty = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
ItemMeta emptyMeta = empty.getItemMeta();
emptyMeta.setDisplayName(" ");
empty.setItemMeta(emptyMeta);
ItemStack close = new ItemStack(Material.BARRIER);
ItemStack nextpage = new ItemStack(Material.SIGN);
ItemStack previouspage = new ItemStack(Material.SIGN);
ItemMeta npMeta = nextpage.getItemMeta();
ItemMeta ppMeta = previouspage.getItemMeta();
ItemMeta closeMeta = close.getItemMeta();
closeMeta.setDisplayName(ChatColor.RED + "Close the menu.");
npMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Next Page");
ppMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Previous Page");
for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
ItemStack skulls = new ItemStack(Material.SKULL_ITEM, 1,(byte) 3);
SkullMeta skullsMeta = (SkullMeta) skulls.getItemMeta();
skullsMeta.setDisplayName(ChatColor.YELLOW + "Teleport " + ChatColor.GREEN + targetPlayer.getName() + ChatColor.YELLOW + " to you.");
skullsMeta.setOwner(targetPlayer.getName());
skulls.setItemMeta(skullsMeta);
int beginningSlot = 9;
tpheremenu.setItem(i+beginningSlot, skulls);
}
tpheremenu.setItem(0, empty);
tpheremenu.setItem(1, empty);
tpheremenu.setItem(2, empty);
tpheremenu.setItem(3, empty);
tpheremenu.setItem(4, empty);
tpheremenu.setItem(5, empty);
tpheremenu.setItem(6, empty);
tpheremenu.setItem(7, empty);
tpheremenu.setItem(8, empty);
tpheremenu.setItem(45, empty);
tpheremenu.setItem(46, empty);
tpheremenu.setItem(47, empty);
tpheremenu.setItem(48, empty);
tpheremenu.setItem(49, close);
tpheremenu.setItem(50, empty);
tpheremenu.setItem(51, empty);
tpheremenu.setItem(52, empty);
tpheremenu.setItem(53, nextpage);
((HumanEntity) sender).openInventory(tpheremenu);
}
示例8: newInventory
public static void newInventory(CommandSender sender) {
Inventory tpmenu = Bukkit.createInventory(null, 54, ChatColor.DARK_GRAY + "Teleport Menu - Page 1");
ItemStack empty = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
ItemMeta emptyMeta = empty.getItemMeta();
emptyMeta.setDisplayName(" ");
empty.setItemMeta(emptyMeta);
ItemStack close = new ItemStack(Material.BARRIER);
ItemStack nextpage = new ItemStack(Material.SIGN);
ItemStack previouspage = new ItemStack(Material.SIGN);
ItemMeta npMeta = nextpage.getItemMeta();
ItemMeta ppMeta = previouspage.getItemMeta();
ItemMeta closeMeta = close.getItemMeta();
closeMeta.setDisplayName(ChatColor.RED + "Close the menu.");
npMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Next Page");
ppMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Previous Page");
for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
ItemStack skulls = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta skullsMeta = (SkullMeta) skulls.getItemMeta();
skullsMeta.setDisplayName(ChatColor.YELLOW + "Teleport to " + ChatColor.GREEN + targetPlayer.getName());
skullsMeta.setOwner(targetPlayer.getName());
skulls.setItemMeta(skullsMeta);
int beginningSlot = 9;
tpmenu.setItem(i + beginningSlot, skulls);
}
tpmenu.setItem(0, empty);
tpmenu.setItem(1, empty);
tpmenu.setItem(2, empty);
tpmenu.setItem(3, empty);
tpmenu.setItem(4, empty);
tpmenu.setItem(5, empty);
tpmenu.setItem(6, empty);
tpmenu.setItem(7, empty);
tpmenu.setItem(8, empty);
tpmenu.setItem(45, empty);
tpmenu.setItem(46, empty);
tpmenu.setItem(47, empty);
tpmenu.setItem(48, empty);
tpmenu.setItem(49, close);
tpmenu.setItem(50, empty);
tpmenu.setItem(51, empty);
tpmenu.setItem(52, empty);
tpmenu.setItem(53, nextpage);
((HumanEntity) sender).openInventory(tpmenu);
}
示例9: newInventory
public static void newInventory(CommandSender sender) {
Inventory tpheremenu = Bukkit.createInventory(null, 54, ChatColor.DARK_GRAY + "Teleport Here Menu - Page 1");
ItemStack empty = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
ItemMeta emptyMeta = empty.getItemMeta();
emptyMeta.setDisplayName(" ");
empty.setItemMeta(emptyMeta);
ItemStack close = new ItemStack(Material.BARRIER);
ItemStack nextpage = new ItemStack(Material.SIGN);
ItemStack previouspage = new ItemStack(Material.SIGN);
ItemMeta npMeta = nextpage.getItemMeta();
ItemMeta ppMeta = previouspage.getItemMeta();
ItemMeta closeMeta = close.getItemMeta();
closeMeta.setDisplayName(ChatColor.RED + "Close the menu.");
npMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Next Page");
ppMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Previous Page");
for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
ItemStack skulls = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta skullsMeta = (SkullMeta) skulls.getItemMeta();
skullsMeta.setDisplayName(ChatColor.YELLOW + "Teleport " + ChatColor.GREEN + targetPlayer.getName() + ChatColor.YELLOW + " to you.");
skullsMeta.setOwner(targetPlayer.getName());
skulls.setItemMeta(skullsMeta);
int beginningSlot = 9;
tpheremenu.setItem(i + beginningSlot, skulls);
}
tpheremenu.setItem(0, empty);
tpheremenu.setItem(1, empty);
tpheremenu.setItem(2, empty);
tpheremenu.setItem(3, empty);
tpheremenu.setItem(4, empty);
tpheremenu.setItem(5, empty);
tpheremenu.setItem(6, empty);
tpheremenu.setItem(7, empty);
tpheremenu.setItem(8, empty);
tpheremenu.setItem(45, empty);
tpheremenu.setItem(46, empty);
tpheremenu.setItem(47, empty);
tpheremenu.setItem(48, empty);
tpheremenu.setItem(49, close);
tpheremenu.setItem(50, empty);
tpheremenu.setItem(51, empty);
tpheremenu.setItem(52, empty);
tpheremenu.setItem(53, nextpage);
((HumanEntity) sender).openInventory(tpheremenu);
}
示例10: getSign
public Sign getSign() {
if (signBlock.getType() == Material.WALL_SIGN || signBlock.getType() == Material.SIGN)
this.sign = (Sign) signBlock.getState();
return this.sign;
}