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


Java EntityEquipment.setHelmet方法代碼示例

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


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

示例1: giveArmor

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
private void giveArmor(LivingEntity entity, PluginConfig worldConfig) {
    String name = ListUtils.getRandom(worldConfig.getStringList(Config.FEATURE_ZOMBIE_ARMOR_ARMOR)).toUpperCase();

    if (Material.getMaterial(name + "_BOOTS") == null) {
        plugin.getLogger().log(Level.WARNING, "{0} is not a valid armor name", name);
        return;
    }

    EntityEquipment equipment = entity.getEquipment();

    equipment.setBoots(new ItemStack(Material.getMaterial(name + "_BOOTS")));
    equipment.setLeggings(new ItemStack(Material.getMaterial(name + "_LEGGINGS")));
    equipment.setChestplate(new ItemStack(Material.getMaterial(name + "_CHESTPLATE")));
    equipment.setHelmet(new ItemStack(Material.getMaterial(name + "_HELMET")));

    float dropChance = worldConfig.getInt(Config.FEATURE_ZOMBIE_ARMOR_DROP_CHANCE) / 100.0f;

    equipment.setBootsDropChance(dropChance);
    equipment.setLeggingsDropChance(dropChance);
    equipment.setChestplateDropChance(dropChance);
    equipment.setHelmetDropChance(dropChance);
}
 
開發者ID:Samistine,項目名稱:BloodMoon,代碼行數:23,代碼來源:ZombieArmorListener.java

示例2: onStop

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onStop(BloodMoonEndEvent event) {
    World world = event.getWorld();

    if (plugin.isFeatureEnabled(world, Feature.ZOMBIE_ARMOR)) {
        for (LivingEntity entity : event.getWorld().getLivingEntities()) {
            if (entity.getType() == EntityType.ZOMBIE) {
                EntityEquipment equipment = entity.getEquipment();

                equipment.setBoots(null);
                equipment.setLeggings(null);
                equipment.setChestplate(null);
                equipment.setHelmet(null);

                equipment.setBootsDropChance(0.0f);
                equipment.setLeggingsDropChance(0.0f);
                equipment.setChestplateDropChance(0.0f);
                equipment.setHelmetDropChance(0.0f);
            }
        }
    }
}
 
開發者ID:Samistine,項目名稱:BloodMoon,代碼行數:23,代碼來源:ZombieArmorListener.java

示例3: ZombieSpawn

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
public void ZombieSpawn(BlockBreakEvent event){
    Location loc = event.getBlock().getLocation();
    World world = loc.getWorld();
    Zombie zombie = (Zombie)  world.spawnEntity(loc,EntityType.ZOMBIE);
    zombie.setCustomName("Bob the Zombie");
    zombie.setCustomNameVisible(true);
    zombie.setMaxHealth(90);
    zombie.setHealth(90);
    zombie.setVillager(true);
    zombie.setTarget(event.getPlayer());
    EntityEquipment zombieEquipment = zombie.getEquipment();
    zombieEquipment.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
    zombieEquipment.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
    zombieEquipment.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
    zombieEquipment.setBoots(new ItemStack(Material.GOLD_BOOTS));
    ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
    sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 4);
    zombieEquipment.setItemInHand(sword);
    zombieEquipment.setItemInHandDropChance(0.5F);
}
 
開發者ID:josegrobles,項目名稱:LuckyBlocksBukkit,代碼行數:21,代碼來源:LuckyBlocksActionController.java

示例4: onCommand

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
@Override
protected void onCommand(CommandSender sender, String[] args) {
    Player player = (Player) sender;

    EntityEquipment e = player.getEquipment();
    ItemStack held = e.getItemInMainHand();
    e.setItemInMainHand(e.getHelmet());
    e.setHelmet(held);

    sender.sendMessage(ChatColor.GOLD + "Enjoy your new hat.");
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:12,代碼來源:CommandHat.java

示例5: restoreLiving

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
private void restoreLiving(final LivingEntity entity) {
    if (this.lived.loot) {
        entity.setCanPickupItems(this.lived.loot);
    }
    if (this.lived.name != null) {
        entity.setCustomName(this.lived.name);
        entity.setCustomNameVisible(this.lived.visible);
    }
    if ((this.lived.potions != null) && (this.lived.potions.size() > 0)) {
        entity.addPotionEffects(this.lived.potions);
    }
    entity.setRemainingAir(this.lived.air);
    entity.setRemoveWhenFarAway(this.lived.persistent);
    if (this.lived.equipped) {
        final EntityEquipment equipment = entity.getEquipment();
        equipment.setItemInHand(this.lived.hands);
        equipment.setHelmet(this.lived.helmet);
        equipment.setChestplate(this.lived.chestplate);
        equipment.setLeggings(this.lived.leggings);
        equipment.setBoots(this.lived.boots);
    }
    if (this.lived.leashed) {
        // TODO leashes
        //            World world = entity.getWorld();
        //            Entity leash = world.spawnEntity(new Location(world, Math.floor(x) + lived.leash_x, Math.floor(y) + lived.leash_y, Math.floor(z) + lived.leash_z), EntityType.LEASH_HITCH);
        //            entity.setLeashHolder(leash);
    }
}
 
開發者ID:Mayomi,項目名稱:PlotSquared-Chinese,代碼行數:29,代碼來源:EntityWrapper.java

示例6: createRobot

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
private void createRobot(Skeleton s) {
	EntityEquipment e = s.getEquipment();
	e.setHelmet(new ItemStack(Material.DISPENSER, 1));
	e.setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));
	e.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS, 1));
	e.setLeggings(new ItemStack(Material.IRON_BOOTS, 1));
	e.setItemInMainHand(new ItemStack(Material.BOW, 1));
	permaVanish(s);
}
 
開發者ID:StarQuestMinecraft,項目名稱:StarQuestCode,代碼行數:10,代碼來源:EntityListener.java

示例7: DroneShocktroop

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
public DroneShocktroop(Player target){
	this.target = target;
	Location l = getSafeLocationNearTarget();
	if(l == null) l = target.getLocation();
	mySkeleton = (Skeleton) target.getWorld().spawnEntity(l, EntityType.SKELETON);
	target.playSound(mySkeleton.getLocation(), Sound.PORTAL_TRAVEL, 2.0F, 2.0F);
	mySkeleton.setCustomName("Skywatch Shock Trooper");
	mySkeleton.setCustomNameVisible(true);
	EntityEquipment e = mySkeleton.getEquipment();
	ItemStack hat = new ItemStack(Material.DISPENSER, 1);
	ItemStack chest = new ItemStack(Material.DIAMOND_CHESTPLATE, 1);
	ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS, 1);
	ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS, 1);
	chest.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, SQSkywatch.protectionLevel);
	leggings.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, SQSkywatch.protectionLevel);
	boots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, SQSkywatch.protectionLevel);
	e.setHelmet(hat);
	e.setChestplate(chest);
	e.setLeggings(leggings);
	e.setBoots(boots);
	

	ItemStack bow = new ItemStack(Material.BOW, 1);
	bow.addEnchantment(Enchantment.ARROW_DAMAGE, SQSkywatch.powerLevel);
	bow.addEnchantment(Enchantment.ARROW_KNOCKBACK, SQSkywatch.knockbackLevel);
	if(SQSkywatch.flameBows){
		bow.addEnchantment(Enchantment.ARROW_FIRE, 1);
	}
	e.setItemInHand(bow);
	mySkeleton.setTarget(target);
	mySkeleton.getWorld().playEffect(mySkeleton.getLocation(), Effect.ENDER_SIGNAL, 0);
}
 
開發者ID:StarQuestMinecraft,項目名稱:StarQuestCode,代碼行數:33,代碼來源:DroneShocktroop.java

示例8: restoreEquipment

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
void restoreEquipment(LivingEntity entity) {
    EntityEquipment equipment = entity.getEquipment();
    if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
        equipment.setItemInMainHand(this.lived.mainHand);
        equipment.setItemInOffHand(this.lived.offHand);
    } else {
        equipment.setItemInHand(this.lived.mainHand);
    }
    equipment.setHelmet(this.lived.helmet);
    equipment.setChestplate(this.lived.chestplate);
    equipment.setLeggings(this.lived.leggings);
    equipment.setBoots(this.lived.boots);
}
 
開發者ID:IntellectualSites,項目名稱:PlotSquared,代碼行數:14,代碼來源:EntityWrapper.java

示例9: giveEquipment

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
private void giveEquipment(EntityEquipment equipment, GiveKitEvent event) {

        if (event.getHelmet() != null)
            equipment.setHelmet(event.getHelmet());

        if (event.getChestplate() != null)
            equipment.setChestplate(event.getChestplate());

        if (event.getLeggings() != null)
            equipment.setLeggings(event.getLeggings());

        if (event.getBoots() != null)
            equipment.setBoots(event.getBoots());
    }
 
開發者ID:JCThePants,項目名稱:NucleusFramework,代碼行數:15,代碼來源:NucleusKit.java

示例10: onEntitySpawn

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
@EventHandler
public void onEntitySpawn(CreatureSpawnEvent event) {
    if (event.getEntity() != null) {
        if (event.getEntity() instanceof Monster) {
            EntityLevelManager entityLevelManager = plugin.getEntityLevelManager();
            int level = entityLevelManager.getEntityLevel(event.getEntity());
            if (level == 0) {
                event.setCancelled(true);
            } else {
                EntityEquipment equipment = event.getEntity().getEquipment();
                if (level > 5 && level <= 10) {
                    equipment.setHelmet(new ItemStack(Material.LEATHER_HELMET));
                    equipment.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
                    equipment.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
                    equipment.setBoots(new ItemStack(Material.LEATHER_BOOTS));
                } else if (level > 10 && level <= 15) {
                    equipment.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
                    equipment.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
                    equipment.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
                    equipment.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
                } else if (level > 15 && level <= 20) {
                    equipment.setHelmet(new ItemStack(Material.IRON_HELMET));
                    equipment.setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
                    equipment.setLeggings(new ItemStack(Material.IRON_LEGGINGS));
                    equipment.setBoots(new ItemStack(Material.IRON_BOOTS));
                } else if (level > 20 && level <= 25) {
                    equipment.setHelmet(new ItemStack(Material.GOLD_HELMET));
                    equipment.setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
                    equipment.setLeggings(new ItemStack(Material.GOLD_LEGGINGS));
                    equipment.setBoots(new ItemStack(Material.GOLD_BOOTS));
                } else if (level > 25) {
                    equipment.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
                    equipment.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
                    equipment.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
                    equipment.setBoots(new ItemStack(Material.DIAMOND_BOOTS));
                }
            }
        }
    }
}
 
開發者ID:WaywardRealms,項目名稱:Wayward,代碼行數:41,代碼來源:CreatureSpawnListener.java

示例11: setHelmet

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
public void setHelmet(LivingEntity e)
{
	ItemStack helmet = new ItemStack(Material.LEATHER_HELMET,1);
	ItemMeta meta = helmet.getItemMeta();
	meta.setDisplayName("Christmas Hat");
	helmet.setItemMeta(meta);

	LeatherArmorMeta lmeta = (LeatherArmorMeta) helmet.getItemMeta();
	lmeta.setColor(Color.RED);
	helmet.setItemMeta(lmeta);

	EntityEquipment ee = e.getEquipment();
	ee.setHelmet(helmet);
}
 
開發者ID:EmilHernvall,項目名稱:tregmine,代碼行數:15,代碼來源:SpawnListener.java

示例12: create

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
public static PigZombie create(Location l) {
	PigZombie police = (PigZombie) l.getWorld().spawnEntity(l, EntityType.PIG_ZOMBIE);
	Pig hov = (Pig) l.getWorld().spawnEntity(l, EntityType.PIG);
	
	police.setMaxHealth(80);
	police.setHealth(80);
	
	ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
	LeatherArmorMeta helmMeta = (LeatherArmorMeta) helm.getItemMeta();
	helmMeta.setColor(Color.BLACK);
	helmMeta.setDisplayName(ChatColor.BOLD + "Bullet Proof Helmet");
	helmMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
	
	helm.setItemMeta(helmMeta);
	
	ItemStack chest = new ItemStack(Material.LEATHER_CHESTPLATE);
	LeatherArmorMeta chestMeta = (LeatherArmorMeta) chest.getItemMeta();
	chestMeta.setColor(Color.BLACK);
	chestMeta.setDisplayName(ChatColor.BOLD + "Bullet Proof Vest");
	chestMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);

	chest.setItemMeta(chestMeta);
	
	ItemStack leg = new ItemStack(Material.LEATHER_LEGGINGS);
	LeatherArmorMeta legMeta = (LeatherArmorMeta) leg.getItemMeta();
	legMeta.setColor(Color.BLACK);
	legMeta.setDisplayName(ChatColor.BOLD + "Bullet Proof Leggings");
	legMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
	
	leg.setItemMeta(legMeta);
	
	ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
	LeatherArmorMeta bootsMeta = (LeatherArmorMeta) boots.getItemMeta();
	bootsMeta.setColor(Color.BLACK);
	bootsMeta.setDisplayName(ChatColor.BOLD + "Bullet Proof Boots");
	bootsMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
	bootsMeta.addEnchant(Enchantment.PROTECTION_FALL, 15, true);
	
	boots.setItemMeta(bootsMeta);
	
	EntityEquipment ee = police.getEquipment();
	
	ee.setHelmet(helm);
	ee.setChestplate(chest);
	ee.setLeggings(leg);
	ee.setBoots(boots);
	
	ee.setItemInOffHand(new ItemStack(Material.CARROT_STICK));
	
	police.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1, true, false));
	hov.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 4, true, false));
	
	hov.setPassenger(police);
	
	police.setCustomName("Officer");
	police.setCustomNameVisible(true);
	police.addScoreboardTag("law");
	
	
	return police;
}
 
開發者ID:GigaGamma,項目名稱:SuperiorCraft,代碼行數:62,代碼來源:Police.java

示例13: set

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
@Override
public void set(final EntityEquipment e, final @Nullable ItemStack item) {
	e.setHelmet(item);
}
 
開發者ID:nfell2009,項目名稱:Skript,代碼行數:5,代碼來源:EquipmentSlot.java

示例14: valueOf

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public static ShopNPC valueOf(Map<String, Object> map) {
	if (map == null || !map.containsKey("name") || !map.containsKey("type") 
			 || !map.containsKey("location") || !map.containsKey("equipment")
			  || !map.containsKey("message") || !map.containsKey("shop")) {
		QuestManagerPlugin.logger.warning("Invalid NPC info! "
				+ (map.containsKey("name") ? ": " + map.get("name") : ""));
		return null;
	}
	
	
	EquipmentConfiguration econ = new EquipmentConfiguration();
	try {
		YamlConfiguration tmp = new YamlConfiguration();
		tmp.createSection("key",  (Map<?, ?>) map.get("equipment"));
		econ.load(tmp.getConfigurationSection("key"));
	} catch (InvalidConfigurationException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
	LocationState ls = (LocationState) map.get("location");
	Location loc = ls.getLocation();
	
	ShopNPC npc = new ShopNPC(loc);
	EntityType type = EntityType.valueOf((String) map.get("type"));
	
	npc.name = (String) map.get("name");
	
	npc.inventory = (ShopInventory) map.get("shop");
	

	loc.getChunk();
	npc.setEntity(loc.getWorld().spawnEntity(loc, type));
	npc.getEntity().setCustomName((String) map.get("name"));

	if (npc.getEntity() instanceof LivingEntity) {
		EntityEquipment equipment = ((LivingEntity) npc.getEntity()).getEquipment();
		equipment.setHelmet(econ.getHead());
		equipment.setChestplate(econ.getChest());
		equipment.setLeggings(econ.getLegs());
		equipment.setBoots(econ.getBoots());
		equipment.setItemInMainHand(econ.getHeldMain());
		equipment.setItemInOffHand(econ.getHeldOff());
		
	}
	
	npc.chat = (BioptionMessage) map.get("message");		
	
	//provide our npc's name, unless we don't have one!
	if (npc.name != null && !npc.name.equals("")) {
		FancyMessage label = new FancyMessage(npc.name);
		npc.chat.setSourceLabel(label);			
	}
	
	//update code 3
	if (map.containsKey("badrequirementmessage"))
		npc.altMessage = (Message) map.get("badrequirementmessage");
	if (map.containsKey("requiredquests"))
	npc.requirements = (List<String>) map.get("requiredquests");
	
	return npc;
}
 
開發者ID:Dove-Bren,項目名稱:QuestManager,代碼行數:64,代碼來源:ShopNPC.java

示例15: valueOf

import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
public static DummyNPC valueOf(Map<String, Object> map) {
	if (map == null || !map.containsKey("name") || !map.containsKey("type") 
			 || !map.containsKey("location") || !map.containsKey("equipment")) {
		QuestManagerPlugin.logger.warning("Invalid NPC info! "
				+ (map.containsKey("name") ? ": " + map.get("name") : ""));
		return null;
	}
	
	EquipmentConfiguration econ = new EquipmentConfiguration();
	try {
		YamlConfiguration tmp = new YamlConfiguration();
		tmp.createSection("key",  (Map<?, ?>) map.get("equipment"));
		econ.load(tmp.getConfigurationSection("key"));
	} catch (InvalidConfigurationException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
	LocationState ls = (LocationState) map.get("location");
	Location loc = ls.getLocation();
	
	EntityType type = EntityType.valueOf((String) map.get("type"));
	
	
	DummyNPC npc = new DummyNPC(loc);

	loc.getChunk();
	npc.setEntity(loc.getWorld().spawnEntity(loc, type));
	npc.setStartingLoc(loc);
	npc.getEntity().setCustomName((String) map.get("name"));
	
	npc.name = (String) map.get("name");

	if (npc.getEntity() instanceof LivingEntity) {
		EntityEquipment equipment = ((LivingEntity) npc.getEntity()).getEquipment();
		equipment.setHelmet(econ.getHead());
		equipment.setChestplate(econ.getChest());
		equipment.setLeggings(econ.getLegs());
		equipment.setBoots(econ.getBoots());
		equipment.setItemInMainHand(econ.getHeldMain());
		equipment.setItemInOffHand(econ.getHeldOff());
		
	}
	
	return npc;
}
 
開發者ID:Dove-Bren,項目名稱:QuestManager,代碼行數:47,代碼來源:DummyNPC.java


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