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


Java Material.DIAMOND_HELMET属性代码示例

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


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

示例1: isPieceOfArmor

private static boolean isPieceOfArmor(ItemStack stack)
{
    if (stack.getType() == Material.LEATHER_HELMET || stack.getType() == Material.LEATHER_CHESTPLATE || stack.getType() == Material.LEATHER_LEGGINGS || stack.getType() == Material.LEATHER_BOOTS)
        return true;
    else if (stack.getType() == Material.IRON_HELMET || stack.getType() == Material.IRON_CHESTPLATE || stack.getType() == Material.IRON_LEGGINGS || stack.getType() == Material.IRON_BOOTS)
        return true;
    else if (stack.getType() == Material.CHAINMAIL_HELMET || stack.getType() == Material.CHAINMAIL_CHESTPLATE || stack.getType() == Material.CHAINMAIL_LEGGINGS || stack.getType() == Material.CHAINMAIL_BOOTS)
        return true;
    else if (stack.getType() == Material.GOLD_HELMET || stack.getType() == Material.GOLD_CHESTPLATE || stack.getType() == Material.GOLD_LEGGINGS || stack.getType() == Material.GOLD_BOOTS)
        return true;
    else if (stack.getType() == Material.DIAMOND_HELMET || stack.getType() == Material.DIAMOND_CHESTPLATE || stack.getType() == Material.DIAMOND_LEGGINGS || stack.getType() == Material.DIAMOND_BOOTS)
        return true;

    return false;
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:15,代码来源:PlayerProtectionListener.java

示例2: onCraftItem

@EventHandler(priority = EventPriority.HIGH)
public void onCraftItem(CraftItemEvent event) 
{
	if( event.getRecipe().getResult().getType() == Material.STONE_SWORD
			|| event.getRecipe().getResult().getType() == Material.IRON_SWORD
			|| event.getRecipe().getResult().getType() == Material.GOLD_SWORD
			|| event.getRecipe().getResult().getType() == Material.DIAMOND_SWORD
|| event.getRecipe().getResult().getType() == Material.LEATHER_BOOTS
			|| event.getRecipe().getResult().getType() == Material.LEATHER_LEGGINGS
			|| event.getRecipe().getResult().getType() == Material.LEATHER_CHESTPLATE
			|| event.getRecipe().getResult().getType() == Material.LEATHER_HELMET
|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_BOOTS
			|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_LEGGINGS
			|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_CHESTPLATE
			|| event.getRecipe().getResult().getType() == Material.CHAINMAIL_HELMET
|| event.getRecipe().getResult().getType() == Material.GOLD_BOOTS
			|| event.getRecipe().getResult().getType() == Material.GOLD_LEGGINGS
			|| event.getRecipe().getResult().getType() == Material.GOLD_CHESTPLATE
			|| event.getRecipe().getResult().getType() == Material.GOLD_HELMET
			|| event.getRecipe().getResult().getType() == Material.IRON_BOOTS
			|| event.getRecipe().getResult().getType() == Material.IRON_LEGGINGS
			|| event.getRecipe().getResult().getType() == Material.IRON_CHESTPLATE
			|| event.getRecipe().getResult().getType() == Material.IRON_HELMET
			|| event.getRecipe().getResult().getType() == Material.DIAMOND_BOOTS
			|| event.getRecipe().getResult().getType() == Material.DIAMOND_LEGGINGS
			|| event.getRecipe().getResult().getType() == Material.DIAMOND_CHESTPLATE
			|| event.getRecipe().getResult().getType() == Material.DIAMOND_HELMET)
	{
		if( event.getWhoClicked().getType() == EntityType.PLAYER )
		{
			Player p = (Player)event.getWhoClicked();
			p.sendMessage("Sorry, you are not allowed to craft this item. Purchase it from a Safe Dock instead.");
		}
		event.setCancelled(false);
	}
 
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:37,代码来源:NavyCraft_InventoryListener.java

示例3: isDressed

public boolean isDressed(Player p)
{
 if( this.type.canFly )
 {
   if( p.getInventory().getHelmet() != null && p.getInventory().getHelmet().getType() == Material.CHAINMAIL_HELMET )
{
   	if( p.getInventory().getChestplate() != null && p.getInventory().getChestplate().getType() == Material.CHAINMAIL_CHESTPLATE )
	{
   		if( p.getInventory().getLeggings() != null && p.getInventory().getLeggings().getType() == Material.CHAINMAIL_LEGGINGS )
		{
   			if( p.getInventory().getBoots() != null && p.getInventory().getBoots().getType() == Material.CHAINMAIL_BOOTS )
			{
   				return true;
			}	
		}	
	}	
}
   p.sendMessage(ChatColor.RED + "You need to wear pilot (chainmail) uniform to use this.");
   return false;
 }else if( this.type.isTerrestrial)
 {
  if( p.getInventory().getHelmet() != null && p.getInventory().getHelmet().getType() == Material.IRON_HELMET )
{
   	if( p.getInventory().getChestplate() != null && p.getInventory().getChestplate().getType() == Material.IRON_CHESTPLATE )
	{
   		if( p.getInventory().getLeggings() != null && p.getInventory().getLeggings().getType() == Material.IRON_LEGGINGS )
		{
   			if( p.getInventory().getBoots() != null && p.getInventory().getBoots().getType() == Material.IRON_BOOTS )
			{
   				return true;
			}	
		}	
	}	
}
   p.sendMessage(ChatColor.RED + "You need to wear soldier (iron) uniform to use this.");
   return false;  
 }else
 {
  if( p.getInventory().getHelmet() != null && (p.getInventory().getHelmet().getType() == Material.LEATHER_HELMET || p.getInventory().getHelmet().getType() == Material.GOLD_HELMET || p.getInventory().getHelmet().getType() == Material.DIAMOND_HELMET) )
{
   	if( p.getInventory().getChestplate() != null && (p.getInventory().getChestplate().getType() == Material.LEATHER_CHESTPLATE || p.getInventory().getChestplate().getType() == Material.GOLD_CHESTPLATE || p.getInventory().getChestplate().getType() == Material.DIAMOND_CHESTPLATE) )
	{
   		if( p.getInventory().getLeggings() != null && (p.getInventory().getLeggings().getType() == Material.LEATHER_LEGGINGS || p.getInventory().getLeggings().getType() == Material.GOLD_LEGGINGS || p.getInventory().getLeggings().getType() == Material.DIAMOND_LEGGINGS) )
		{
   			if( p.getInventory().getBoots() != null && (p.getInventory().getBoots().getType() == Material.LEATHER_BOOTS || p.getInventory().getBoots().getType() == Material.GOLD_BOOTS || p.getInventory().getBoots().getType() == Material.DIAMOND_BOOTS) )
			{
   				return true;
			}	
		}	
	}	
}
   p.sendMessage(ChatColor.RED + "You need to wear sailor (leather) or captain (gold) uniform to use this.");
   return false;  
 }
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:55,代码来源:Craft.java

示例4: updateJoinMenu

public void updateJoinMenu(final GamePlayer gamePlayer) {
if (!SkyWarsReloaded.getIC().has(gamePlayer.getP()) || gamePlayer.inGame() || !SkyWarsReloaded.getIC().getMenu(gamePlayer.getP()).getName().equalsIgnoreCase(joinName)) {
	return;
} else {
       ArrayList<Game> games = SkyWarsReloaded.getGC().getGames();
       
       for (int iii = 0; iii < games.size(); iii++) {
           if (iii >= menuSize) {
               break;
           }

           Game game = games.get(iii);
           	            
           List<String> loreList = Lists.newLinkedList();
           if (game.getState() != GameState.PREGAME) {
            loreList.add((new Messaging.MessageFormatter().format("signJoinSigns.inprogress").toUpperCase()));
           }
           loreList.add(ChatColor.RED + "" + ChatColor.BOLD + game.getMapName().toUpperCase());
              loreList.add((new Messaging.MessageFormatter().format("menu.spectate-game-header") + "  " + game.getPlayers().size() + "/" + game.getNumberOfSpawns()));
           for (GamePlayer gPlayer: game.getPlayers()) {
           	if (gPlayer.getP() != null) {
            	loreList.add(ChatColor.WHITE + gPlayer.getP().getName());
           	}
           }
           
           double xy = ((double) (game.getPlayers().size() / game.getNumberOfSpawns()));
           
           Material gameIcon = Material.REDSTONE_BLOCK;
           String gameNumber = String.valueOf(game.getGameNumber());
           if (game.getState() == GameState.PREGAME) {
           	gameIcon =  Material.DIAMOND_HELMET;
   	    	if (xy < 0.75) {
   	    		gameIcon = Material.GOLD_HELMET;
   	    	} 
   	    	if (xy < 0.50) {
   	    		gameIcon =  Material.IRON_HELMET;
   	    	} 
   	    	if (xy < 0.25) {
   	    		gameIcon =  Material.LEATHER_HELMET;
   	    	} 
           }  
           
           if (gamePlayer.getP() != null) {
            SkyWarsReloaded.getIC().setOption(
                    gamePlayer.getP(),
                    iii,
                    new ItemStack(gameIcon, 1),
                    gameNumber,
                    loreList.toArray(new String[loreList.size()]));
           }
          }
       
       if (gamePlayer.getP() != null && !gamePlayer.inGame()) {
        SkyWarsReloaded.getIC().update(gamePlayer.getP());
       }
       
       final GamePlayer player = gamePlayer;

       SkyWarsReloaded.get().getServer().getScheduler().scheduleSyncDelayedTask(SkyWarsReloaded.get(), new Runnable() {
		@Override
		public void run() {
			updateJoinMenu(player);	
		}
       }, 40); 
}
  }
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:66,代码来源:JoinMenu.java

示例5: clearJunk

public void clearJunk(){
	World world = Bukkit.getWorld("kaospvp");
	List<Entity> list = world.getEntities();
	for(Entity e : list){
		if(e instanceof Item){
			Item it = (Item) e;
			if( it.getItemStack().getType() == Material.POTION &&
				it.getItemStack().getDurability() == 16453){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.GOLDEN_APPLE &&
				it.getItemStack().getDurability() == 0){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.ARROW){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.GLASS_BOTTLE){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.DIAMOND_BOOTS &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.DIAMOND_LEGGINGS &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.DIAMOND_CHESTPLATE &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.DIAMOND_HELMET &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();
			}
			if( it.getItemStack().getType() == Material.DIAMOND_SWORD &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();	
			}
			if( it.getItemStack().getType() == Material.BOW &&
				it.getItemStack().getEnchantments().size() == 0){
				e.remove();	
			}
			if( it.getItemStack().getType() == Material.WOOD_AXE ||
				it.getItemStack().getType() == Material.STONE_AXE ||
				it.getItemStack().getType() == Material.GOLD_AXE ||
				it.getItemStack().getType() == Material.IRON_AXE ||
				it.getItemStack().getType() == Material.DIAMOND_AXE){
				e.remove();
			}
		}
	}
}
 
开发者ID:OverloadedCore,项目名称:kaosEssentials,代码行数:54,代码来源:Core.java

示例6: giveTitaniumKit

private void giveTitaniumKit(Player player) {
	if(player.hasPermission("riots.titanium")) {
		if(cooldowns.containsKey(player.getUniqueId())) {
			if(cooldowns.get(player.getUniqueId()).containsKey("TitaniumKit")) {
				this.closeInventory(player);
				player.sendMessage(ChatColor.RED + "You cannot receive this kit for " + ChatColor.BOLD + DurationFormatUtils.formatDurationWords(cooldowns.get(player.getUniqueId()).get("TitaniumKit"), true, true) + ChatColor.RED + "!");
			} else {
				cooldowns.put(player.getUniqueId(), (Map<String, Long>) new AbstractMap.SimpleEntry<String, Long>("TitanKit", day * 3));
				ItemStack helm = new ItemStack(Material.DIAMOND_HELMET, 1);
				ItemMeta helmMeta = helm.getItemMeta();
				
				helmMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&4&lTitanium &7Kit"));
				helm.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, protection);
				helm.addUnsafeEnchantment(Enchantment.DURABILITY, unbreaking);
				helm.setItemMeta(helmMeta);
			   
				ItemStack cp = new ItemStack(Material.DIAMOND_CHESTPLATE, 1);
				ItemMeta cpMeta = cp.getItemMeta();
				
				cpMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&4&lTitanium &7Kit"));
				cp.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, protection);
				cp.addUnsafeEnchantment(Enchantment.DURABILITY, unbreaking);
				cp.setItemMeta(cpMeta);
				
				ItemStack legs = new ItemStack(Material.DIAMOND_LEGGINGS, 1);
				ItemMeta legsMeta = legs.getItemMeta();
				
				legsMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&4&lTitanium &7Kit"));
				legs.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, protection);
				legs.addUnsafeEnchantment(Enchantment.DURABILITY, unbreaking);
				legs.setItemMeta(legsMeta);
				
				ItemStack booties = new ItemStack(Material.DIAMOND_BOOTS, 1);
				ItemMeta bootiesMeta = booties.getItemMeta();
				
				bootiesMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&4&lTitanium &7Kit"));
				booties.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, protection);
				booties.addUnsafeEnchantment(Enchantment.DURABILITY, unbreaking);
				booties.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 4);
				booties.setItemMeta(bootiesMeta);
				
				ItemStack sword = new ItemStack(Material.DIAMOND_SWORD, 1);
				ItemMeta swordMeta = sword.getItemMeta();
				
				sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, sharpness);
				sword.addUnsafeEnchantment(Enchantment.DURABILITY, unbreaking);
				swordMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&4&lTitanium &7Kit"));
				
				sword.setItemMeta(swordMeta);
				
				ItemStack pearls = new ItemStack(Material.ENDER_PEARL, 16);
				
				player.getInventory().addItem(helm);
				player.getInventory().addItem(cp);
				player.getInventory().addItem(legs);
				player.getInventory().addItem(booties);
				player.getInventory().addItem(sword);
				player.getInventory().addItem(pearls);
				player.updateInventory();
			}
		}
	} else {
		player.sendMessage(ChatColor.RED + "You do not have access to this kit! Purchase it at store.hcriots.net!");
	}
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:65,代码来源:KitsCommand.java


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