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


Java Material.SIGN属性代码示例

本文整理汇总了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();
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:23,代码来源:PaintballDisplayer.java

示例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();
  }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:25,代码来源:EventSignListener.java

示例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());
        }
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:34,代码来源:PlayerListener.java

示例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;
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:7,代码来源:Lobby.java

示例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;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:10,代码来源:EventSignListener.java

示例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);
  }
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:51,代码来源:TeleportMenu.java

示例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);
  }
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:51,代码来源:TeleportHereMenu.java

示例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);
}
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:51,代码来源:TeleportMenu.java

示例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);
}
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:51,代码来源:TeleportHereMenu.java

示例10: getSign

public Sign getSign() {
	if (signBlock.getType() == Material.WALL_SIGN || signBlock.getType() == Material.SIGN)
		this.sign = (Sign) signBlock.getState();
	return this.sign;
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:5,代码来源:Arena.java


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