當前位置: 首頁>>代碼示例>>Java>>正文


Java Material.EMERALD屬性代碼示例

本文整理匯總了Java中org.bukkit.Material.EMERALD屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.EMERALD屬性的具體用法?Java Material.EMERALD怎麽用?Java Material.EMERALD使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.bukkit.Material的用法示例。


在下文中一共展示了Material.EMERALD屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setVale

public static void setVale(Player player, int amount) throws SQLException {
    UUID uuid = player.getUniqueId();
    PreparedStatement stmt = plugin.getDb().getConnection().prepareStatement("UPDATE vale_eco SET amount = "+amount+" WHERE uuid = '"+uuid.toString()+"'");
    stmt.executeUpdate();

    ItemStack item = new ItemStack(Material.EMERALD, 1);
    ItemMeta meta = item.getItemMeta();
    meta.setDisplayName(ChatColor.GREEN.toString() + getVale(player) + (getVale(player)==1?" Vale":" Vales"));
    meta.addEnchant(Enchantment.LUCK, 1, true);
    meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
    item.setItemMeta(meta);
    if(plugin.getConfig().getString("valeitemininv").equals("true")){
        player.getInventory().setItem(8, item);
    }

}
 
開發者ID:Warvale,項目名稱:NetworkCore,代碼行數:16,代碼來源:ValeUtil.java

示例2: testisSpaceAvailabletrue

@Test
public void testisSpaceAvailabletrue()
{
    PlayerInventory pi = mock(PlayerInventory.class);
    doReturn(pi).when(player).getInventory();
    ItemStack itemStack = new ItemStack(Material.EMERALD);
    assertTrue(Util.isSpaceAvailable(player, itemStack));
}
 
開發者ID:ThePhilderbeast,項目名稱:prisonPicks,代碼行數:8,代碼來源:UtilTest.java

示例3: testisSpaceAvailablefalse

@Test
public void testisSpaceAvailablefalse()
{
    Player player = spy(Player.class);
    PlayerInventory pi = mock(PlayerInventory.class);
    when(player.getInventory()).thenReturn(pi);
    when(pi.getItem(anyInt())).thenReturn(new ItemStack(Material.GRASS));

    ItemStack itemStack = new ItemStack(Material.EMERALD);
    assertFalse(Util.isSpaceAvailable(player, itemStack));
}
 
開發者ID:ThePhilderbeast,項目名稱:prisonPicks,代碼行數:11,代碼來源:UtilTest.java

示例4: 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

示例5: getBackIcon

protected static ItemStack getBackIcon()
{
    ItemStack stack = new ItemStack(Material.EMERALD, 1);
    ItemMeta meta = stack.getItemMeta();
    meta.setDisplayName(ChatColor.GREEN + "« Retour");
    stack.setItemMeta(meta);

    return stack;
}
 
開發者ID:SamaGames,項目名稱:Hub,代碼行數:9,代碼來源:AbstractGui.java

示例6: onBlockDispense

@EventHandler(priority = EventPriority.HIGH)
public void onBlockDispense(final BlockDispenseEvent event) {
	if (!event.isCancelled()) {
		if (PermissionInterface.CheckEnabledWorld(event.getBlock().getLocation()) && (event.getItem().getType() == Material.EMERALD)) {
			event.setCancelled(true);
		}

	}
	
	if(!event.isCancelled())
		AimCannonPlayerListener.onBlockDispense(event);
}
 
開發者ID:Maximuspayne,項目名稱:NavyCraft2-Lite,代碼行數:12,代碼來源:NavyCraft_BlockListener.java

示例7: getPlaceholder7

/**
 * l.add("��9��һҳ");
 * @return ��һҳ
 */
public static ItemStack getPlaceholder7(){
	ItemStack sw=new ItemStack(Material.EMERALD);
	ItemMeta im = sw.getItemMeta();
	im.setDisplayName("��9��l��һҳ");
	List<String> l=new LinkedList<String>();
	l.add("��9��һ������");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
開發者ID:SchoolUniform,項目名稱:RealSurvival,代碼行數:14,代碼來源:Items.java

示例8: onCompassClick

@EventHandler
public void onCompassClick(PlayerInteractEvent event) {
	if (event.getItem() == null || event.getItem().getType() != Material.EMERALD)
		return;
	Player p = event.getPlayer();
	ItemStack stack = event.getItem();
	if (stack.getItemMeta().hasDisplayName()) {
		String display = Chat.stripColor(stack.getItemMeta().getDisplayName());
		if (display.equalsIgnoreCase("voting panel")) {
			new VotePanel(p).show();
		}
	}
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:13,代碼來源:VotePanelEvents.java

示例9: 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

示例10: customDeath

@EventHandler(priority=EventPriority.HIGHEST)
public void customDeath(EntityDamageByEntityEvent e){
	if(e.isCancelled())return;
	if(e.getEntity() instanceof Player && e.getDamager() instanceof Player){
		Player p = (Player) e.getEntity();
		if(e.getFinalDamage() >= p.getHealth()){
			Player killer = (Player) e.getDamager();
			String uuid2 = killer.getUniqueId().toString();
			e.setCancelled(true);
			if(! p.getName().equals(killer.getName())){ // if they were killed by someone else, not themselves
				setTokens(uuid2, getTokens(uuid2)+2);
				killer.sendMessage(tag + ChatColor.BLUE + "You have received " + ChatColor.GOLD + "2" +
						ChatColor.BLUE + " tokens for killing " + p.getName());
			}
			Bukkit.getServer().broadcastMessage(ChatColor.GRAY + killer.getName() + " destroyed " + p.getName());
			// Set statistics
			//killer.setStatistic(Statistic.KILL_ENTITY, killer.getStatistic(Statistic.KILL_ENTITY) + 1);
			//p.setStatistic(Statistic.DEATHS, p.getStatistic(Statistic.DEATHS) + 1);
			// Reset health, so they dont die
			p.setHealth(p.getMaxHealth());
			// Inventory clearing
			p.getInventory().clear();
			ItemStack air = new ItemStack(Material.AIR);
			p.getInventory().setHelmet(air);
			p.getInventory().setChestplate(air);
			p.getInventory().setLeggings(air);
			p.getInventory().setBoots(air);
			// Drop emerald at death location
			ItemStack reward = new ItemStack(Material.EMERALD);
			p.getWorld().dropItemNaturally(p.getLocation(), reward);
			// Clear potion effects
			for(PotionEffect pe : p.getActivePotionEffects()){
				p.removePotionEffect(pe.getType());
			}
			// Stop infinite kill glitch
			p.setGameMode(GameMode.SPECTATOR);
			p.setGameMode(GameMode.ADVENTURE);
			// Send them to the SPAWN of the world
			p.teleport(p.getWorld().getSpawnLocation());
			p.setFireTicks(0);
		}
	}
}
 
開發者ID:OverloadedCore,項目名稱:kaosEssentials,代碼行數:43,代碼來源:Core.java


注:本文中的org.bukkit.Material.EMERALD屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。