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


Java Material.DIAMOND属性代码示例

本文整理汇总了Java中org.bukkit.Material.DIAMOND属性的典型用法代码示例。如果您正苦于以下问题:Java Material.DIAMOND属性的具体用法?Java Material.DIAMOND怎么用?Java Material.DIAMOND使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.Material的用法示例。


在下文中一共展示了Material.DIAMOND属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBlockState

@Test
public void testBlockState() {
    MaterialData data = new MaterialData(Material.DIAMOND, (byte) 12);
    byte lightLevel = 5;
    Location loc = TestLocation.LOC_ZERO;

    BlockState blockState = new TestBlockState(data, lightLevel, loc);

    String out = OutputFormatter.getOutput(blockState);

    assertNotNull(out);
    assertTrue(out.contains(data.toString()));
    assertTrue(out.contains(String.valueOf(data.getItemTypeId())));
    assertTrue(out.contains(String.valueOf(lightLevel)));
    assertTrue(out.contains(loc.toString()));
}
 
开发者ID:zachbr,项目名称:Debuggery,代码行数:16,代码来源:OutputFormatterTest.java

示例2: onInventoryClick

@EventHandler
void onInventoryClick(InventoryClickEvent event) {
	if (event.getInventory().getTitle().contains("Emoji List")) {
		event.setCancelled(true);
		if (event.getCurrentItem() != null && event.getCurrentItem().getType() == Material.DIAMOND && event.getCurrentItem().hasItemMeta()
				&& event.getCurrentItem().getItemMeta().hasDisplayName()) { // Make sure the item clicked is a page change item
			try {
				int currentPage = Integer.parseInt(event.getInventory().getTitle().split(" ")[3]) - 1; // Get the page number from the title
				
				if (event.getCurrentItem().getItemMeta().getDisplayName().contains("<-")) { // Back button
					event.getWhoClicked().openInventory(plugin.emojiChatGui.getInventory(currentPage - 1));
				} else { // Next button
					event.getWhoClicked().openInventory(plugin.emojiChatGui.getInventory(currentPage + 1));
				}
			} catch (Exception e) { // Something happened, not sure what, so just reset their page to 0
				event.getWhoClicked().openInventory(plugin.emojiChatGui.getInventory(0));
			}
		}
	}
}
 
开发者ID:RadBuilder,项目名称:EmojiChat,代码行数:20,代码来源:EmojiChatListener.java

示例3: load

public void load() {
	// Power Crystal
	
	ItemStack pcrys = new ItemStack(Material.DIAMOND);
   	ItemMeta pcrysm = pcrys.getItemMeta();
   	pcrysm.setDisplayName("&b&lPower Crystal".replace('&', '�'));
   	ArrayList<String> pcrysl = new ArrayList<String>();
   	pcrysl.add("&b&l0 / 100,000 RF".replace('&', '�'));
      	pcrysm.setLore(pcrysl);
      	pcrys.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 100);
   	pcrys.setItemMeta(pcrysm);
	
	CustomItem pc = new PowerCrystal(pcrys, "superiorcraft:power_crystal");
	
	SuperiorCraft.plugin.getServer().getPluginManager().registerEvents(pc, SuperiorCraft.plugin);
	
	// Uranium Ingot
	
	ItemStack uing = new ItemStack(Material.EMERALD);
   	ItemMeta uingm = uing.getItemMeta();
   	uingm.setDisplayName("&2Uranium Ingot".replace('&', '�'));
   	ArrayList<String> uingl = new ArrayList<String>();
   	uingl.add("&2A radioactive material".replace('&', '�'));
      	uingm.setLore(uingl);
      	uing.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 100);
   	uing.setItemMeta(uingm);
	
	CustomItem ui = new UraniumIngot(uing, "more:uranium_ingot");
	SuperiorCraft.plugin.getServer().getPluginManager().registerEvents(ui, SuperiorCraft.plugin);
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:30,代码来源:CustomItem.java

示例4: click

@EventHandler(priority = EventPriority.HIGHEST)
public void click(final InventoryClickEvent event) {
    if(event.getCurrentItem() == null) return;

    Player player = (Player) event.getWhoClicked();
    if(!purchasingMap.containsKey(player)) return;

    Material clicked = event.getCurrentItem().getType();

    for(Gizmo gizmo : gizmos) {
        if(clicked == gizmo.getIcon()) {
            player.closeInventory();
            if(gizmo.ownsGizmo(player)) {
                GizmoUtils.setGizmo(player, gizmo, false);
            } else if(purchasingMap.containsKey(player)) {
                player.sendMessage(ChatColor.GOLD + LobbyTranslations.get().t("gizmo.currentlyPurchasing", player));
            } else if(gizmo.canPurchase(player)) {
                GizmoUtils.openShop(player, gizmo);
                purchasingMap.put(player, gizmo);
            } else {
                player.sendMessage(gizmo.getNoPurchaseMessage(player));
            }

            break;
        }
    }

    if(clicked == Material.DIAMOND) {
        GizmoUtils.purchaseGizmo(player, purchasingMap.get(player));
    } else if(clicked == Material.REDSTONE_BLOCK) {
        GizmoUtils.cancelPurchase(player);
    }

    event.setCancelled(true);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:35,代码来源:Gizmos.java

示例5: openShop

public static void openShop(Player player, Gizmo gizmo) {
    Inventory inventory = Bukkit.createInventory(player, 54, StringUtils.truncate(ChatColor.GOLD + LobbyTranslations.get().t("gizmos.shopFor", player, gizmo.getColoredName(player)), 32));

    inventory.setItem(4, Utils.getGhastTear(player, RaindropsListener.raindrops.get(player)));
    inventory.setItem(22, gizmo.getItemStack(player));

    ItemStack accept = new ItemStack(Material.DIAMOND);
    ItemMeta acceptMeta = accept.getItemMeta();
    acceptMeta.setDisplayName(ChatColor.GREEN + LobbyTranslations.get().t("purchase.purchase", player, gizmo.getColoredName(player)));
    acceptMeta.setLore(Lists.newArrayList(gizmo.getCostText(player)));
    accept.setItemMeta(acceptMeta);

    ItemStack exit = new ItemStack(Material.REDSTONE_BLOCK);
    ItemMeta exitMeta = exit.getItemMeta();
    exitMeta.setDisplayName(ChatColor.RED + LobbyTranslations.get().t("purchase.cancel", player));
    exit.setItemMeta(exitMeta);

    for(int i = 3; i < 6; i++) {
        for(int x = 0; x < 3; x++) {
            inventory.setItem(i * 9 + x, accept);
        }

        for(int y = 6; y < 9; y++) {
            inventory.setItem(i * 9 + y, exit);
        }
    }

    player.openInventory(inventory);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:29,代码来源:GizmoUtils.java

示例6: addMetaIfNeeded

private ItemStack addMetaIfNeeded(ItemStack stack)
{
    Material material = stack.getType();

    if (material == Material.COAL || material == Material.IRON_INGOT || material == Material.GOLD_INGOT || material == Material.DIAMOND || material == Material.EMERALD || material == Material.QUARTZ)
        return Meta.addMeta(stack);
    else
        return stack;
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:9,代码来源:RandomChestModule.java

示例7: addBackArrow

/**
 * Adds the back arrow to the gui specified.
 *
 * @param gui The gui {@link org.bukkit.inventory.Inventory} to add the back arrow to.
 */
private void addBackArrow(Inventory gui) {
	ItemStack backArrowStack = new ItemStack(Material.DIAMOND, 1);
	ItemMeta meta = backArrowStack.getItemMeta();
	meta.setDisplayName(ChatColor.GREEN + "<- Back");
	backArrowStack.setItemMeta(meta);
	gui.setItem(45, backArrowStack);
}
 
开发者ID:RadBuilder,项目名称:EmojiChat,代码行数:12,代码来源:EmojiChatGui.java

示例8: addNextArrow

/**
 * Adds the next arrow to the gui specified.
 *
 * @param gui The gui {@link org.bukkit.inventory.Inventory} to add the next arrow to.
 */
private void addNextArrow(Inventory gui) {
	ItemStack nextArrowStack = new ItemStack(Material.DIAMOND, 1);
	ItemMeta meta = nextArrowStack.getItemMeta();
	meta.setDisplayName(ChatColor.GREEN + "Next ->");
	nextArrowStack.setItemMeta(meta);
	gui.setItem(53, nextArrowStack);
}
 
开发者ID:RadBuilder,项目名称:EmojiChat,代码行数:12,代码来源:EmojiChatGui.java


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