本文整理匯總了Java中org.bukkit.inventory.EntityEquipment.setLeggings方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityEquipment.setLeggings方法的具體用法?Java EntityEquipment.setLeggings怎麽用?Java EntityEquipment.setLeggings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.inventory.EntityEquipment
的用法示例。
在下文中一共展示了EntityEquipment.setLeggings方法的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);
}
示例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);
}
}
}
}
示例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);
}
示例4: 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);
}
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例8: 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());
}
示例9: 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));
}
}
}
}
}
示例10: setLegs
import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
public void setLegs(LivingEntity e)
{
ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS,1);
ItemMeta meta = leggings.getItemMeta();
meta.setDisplayName("Christmas Pants");
leggings.setItemMeta(meta);
LeatherArmorMeta lmeta = (LeatherArmorMeta) leggings.getItemMeta();
lmeta.setColor(Color.WHITE);
leggings.setItemMeta(lmeta);
EntityEquipment ee = e.getEquipment();
ee.setLeggings(leggings);
}
示例11: 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;
}
示例12: set
import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
@Override
public void set(final EntityEquipment e, final @Nullable ItemStack item) {
e.setLeggings(item);
}
示例13: 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;
}
示例14: 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;
}
示例15: valueOf
import org.bukkit.inventory.EntityEquipment; //導入方法依賴的package包/類
public static SimpleBioptionNPC valueOf(Map<String, Object> map) {
if (map == null || !map.containsKey("name") || !map.containsKey("type")
|| !map.containsKey("location") || !map.containsKey("equipment")
|| !map.containsKey("message")) {
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();
SimpleBioptionNPC npc = new SimpleBioptionNPC(loc);
EntityType type = EntityType.valueOf((String) map.get("type"));
npc.name = (String) map.get("name");
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("")) {
npc.chat.setSourceLabel(
new FancyMessage(npc.name));
}
return npc;
}