public void equipEffectsTask() {
RScheduler.schedule(plugin, new Runnable() {
public void run() {
if (isValid()) {
Player p = getPlayer();
EntityEquipment ee = p.getEquipment();
if (ee.getHelmet() != null && ItemManager.isItem(ee.getHelmet(), "miner_helmet")) {
if (!equipStates.contains("miner_helmet")) {
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, true, false), true);
equipStates.add("miner_helmet");
}
} else {
if (equipStates.contains("miner_helmet")) {
equipStates.remove("miner_helmet");
p.removePotionEffect(PotionEffectType.NIGHT_VISION);
}
}
RScheduler.schedule(plugin, this, RTicks.seconds(1));
}
}
});
}
java类org.bukkit.inventory.EntityEquipment的实例源码
PlayerDataRPG.java 文件源码
项目:ZentrelaRPG
阅读 24
收藏 0
点赞 0
评论 0
ZombieArmorListener.java 文件源码
项目:BloodMoon
阅读 17
收藏 0
点赞 0
评论 0
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);
}
ZombieArmorListener.java 文件源码
项目:BloodMoon
阅读 18
收藏 0
点赞 0
评论 0
@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);
}
}
}
}
LuckyBlocksActionController.java 文件源码
项目:LuckyBlocksBukkit
阅读 30
收藏 0
点赞 0
评论 0
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);
}
LuckyBlocksActionController.java 文件源码
项目:LuckyBlocksBukkit
阅读 22
收藏 0
点赞 0
评论 0
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);
}
EntityWrapper.java 文件源码
项目:PlotSquared-Chinese
阅读 23
收藏 0
点赞 0
评论 0
public void storeLiving(final LivingEntity lived) {
this.lived = new LivingEntityStats();
this.lived.potions = lived.getActivePotionEffects();
this.lived.loot = lived.getCanPickupItems();
this.lived.name = lived.getCustomName();
this.lived.visible = lived.isCustomNameVisible();
this.lived.health = (float) lived.getHealth();
this.lived.air = (short) lived.getRemainingAir();
this.lived.persistent = lived.getRemoveWhenFarAway();
this.lived.leashed = lived.isLeashed();
if (this.lived.leashed) {
final Location loc = lived.getLeashHolder().getLocation();
this.lived.leash_x = (short) (this.x - loc.getBlockX());
this.lived.leash_y = (short) (this.y - loc.getBlockY());
this.lived.leash_z = (short) (this.z - loc.getBlockZ());
}
final EntityEquipment equipment = lived.getEquipment();
this.lived.equipped = equipment != null;
if (this.lived.equipped) {
this.lived.hands = equipment.getItemInHand().clone();
this.lived.boots = equipment.getBoots().clone();
this.lived.leggings = equipment.getLeggings().clone();
this.lived.chestplate = equipment.getChestplate().clone();
this.lived.helmet = equipment.getHelmet().clone();
}
}
LEntity.java 文件源码
项目:parchment
阅读 17
收藏 0
点赞 0
评论 0
public static Parameter holdOperation(org.bukkit.entity.LivingEntity le, Context ctx, Parameter set) {
EntityEquipment pent = le.getEquipment();
if ( set != null ) {
if ( set instanceof ItemParameter) {
pent.setItemInHand(((ItemParameter) set).asItemStack(ctx));
} else if ( set instanceof MaterialParameter ) {
pent.setItemInHand(new ItemStack(((MaterialParameter) set).asMaterial(ctx), 1));
} else {
ItemStack s = Item.createItemstackFromString(set.asString(ctx));
pent.setItemInHand(s);
}
}
return Parameter.from(pent.getItemInHand());
}
EntityWrapper.java 文件源码
项目:PlotSquared
阅读 23
收藏 0
点赞 0
评论 0
public void storeLiving(LivingEntity lived) {
this.lived = new LivingEntityStats();
this.lived.potions = lived.getActivePotionEffects();
this.lived.loot = lived.getCanPickupItems();
this.lived.name = lived.getCustomName();
this.lived.visible = lived.isCustomNameVisible();
this.lived.health = (float) lived.getHealth();
this.lived.air = (short) lived.getRemainingAir();
this.lived.persistent = lived.getRemoveWhenFarAway();
this.lived.leashed = lived.isLeashed();
if (this.lived.leashed) {
Location location = lived.getLeashHolder().getLocation();
this.lived.leashX = (short) (this.x - location.getBlockX());
this.lived.leashY = (short) (this.y - location.getBlockY());
this.lived.leashZ = (short) (this.z - location.getBlockZ());
}
EntityEquipment equipment = lived.getEquipment();
this.lived.equipped = equipment != null;
if (this.lived.equipped) {
storeEquipment(equipment);
}
}
SurvivorsListener.java 文件源码
项目:RoyalSurvivors
阅读 25
收藏 0
点赞 0
评论 0
@EventHandler
public void zombify(PlayerDeathEvent e) {
Player p = e.getEntity();
if (!RUtils.isInInfectedWorld(p)) return;
if (!Config.spawnZombie) return;
Zombie z = ZombieSpawner.spawnLeveledZombie(p.getLocation());
if (z == null) return;
EntityEquipment ze = z.getEquipment();
EntityEquipment pe = p.getEquipment();
if (ze == null || pe == null) return;
ze.setArmorContents(pe.getArmorContents());
ze.setHelmetDropChance(0F);
ze.setChestplateDropChance(0F);
ze.setLeggingsDropChance(0F);
ze.setBootsDropChance(0F);
}
Guns.java 文件源码
项目:AddGun
阅读 23
收藏 0
点赞 0
评论 0
/**
* Doesn't seem to work right now but basically, if you smack someone over the head
* with the gun instead of shoot it, do less damage.
*
* @param event The hit event
*/
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void weakDamageDirectWithGun(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof LivingEntity) {
LivingEntity damager = (LivingEntity) event.getDamager();
EntityEquipment equips = damager.getEquipment();
StandardGun gun = findGun(equips.getItemInMainHand());
if (gun != null) {
// modify damage!
event.setDamage(gun.getBluntDamage());
}
}
}
RailGun.java 文件源码
项目:AddGun
阅读 29
收藏 0
点赞 0
评论 0
/**
* Doesn't seem to work right now but basically, if you smack someone over the head
* with the gun instead of shoot it, do less damage.
*
* @param event The hit event
*/
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void weakDamageDirectWithGun(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof LivingEntity) {
LivingEntity damager = (LivingEntity) event.getDamager();
EntityEquipment equips = damager.getEquipment();
if (isGun(equips.getItemInMainHand())) {
// modify damage!
event.setDamage(this.bluntDamage);
}
}
}
CommandHat.java 文件源码
项目:Kineticraft
阅读 21
收藏 0
点赞 0
评论 0
@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.");
}
EEntity.java 文件源码
项目:GameBoxx
阅读 21
收藏 0
点赞 0
评论 0
/**
* Gets the inventory with the equipment worn by the living entity.
* <p/>
* <b>Entities: </b> {@link LivingEntity}, {@link ArmorStand}
*
* @return the living entity's inventory
*/
public EntityEquipment getEquipment() {
if (entity instanceof LivingEntity) {
return ((LivingEntity) entity).getEquipment();
} else if (entity instanceof ArmorStand) {
return ((ArmorStand) entity).getEquipment();
}
return null;
}
ExprArmorSlot.java 文件源码
项目:Skript
阅读 20
收藏 0
点赞 0
评论 0
@Override
@Nullable
public Slot convert(final LivingEntity e) {
final EntityEquipment eq = e.getEquipment();
if (eq == null)
return null;
return new EquipmentSlot(eq, slot);
}
EquipmentSlot.java 文件源码
项目:Skript
阅读 16
收藏 0
点赞 0
评论 0
@SuppressWarnings("deprecation")
@Override
public void set(final EntityEquipment e, final @Nullable ItemStack item) {
if (Skript.isRunningMinecraft(1, 9))
e.setItemInMainHand(item);
else
e.setItemInHand(item); //Compatibility reasons
}
EquipmentSlot.java 文件源码
项目:Skript
阅读 15
收藏 0
点赞 0
评论 0
@SuppressWarnings("deprecation")
@Override
public void set(final EntityEquipment e, final @Nullable ItemStack item) {
if (Skript.isRunningMinecraft(1, 9))
e.setItemInOffHand(item);
else
e.setItemInHand(item); //Compatibility reasons
}
EquipmentConfiguration.java 文件源码
项目:QuestManager
阅读 18
收藏 0
点赞 0
评论 0
public EquipmentConfiguration(EntityEquipment equips) {
this.head = equips.getHelmet();
this.chest = equips.getChestplate();
this.legs = equips.getLeggings();
this.boots = equips.getBoots();
this.heldMain = equips.getItemInMainHand();
this.heldOff = equips.getItemInOffHand();
}
ZombieWeaponListener.java 文件源码
项目:BloodMoon
阅读 19
收藏 0
点赞 0
评论 0
private void giveWeapon(LivingEntity entity, PluginConfig worldConfig) {
String name = ListUtils.getRandom(worldConfig.getStringList(Config.FEATURE_ZOMBIE_WEAPON_WEAPONS)).toUpperCase();
Material type = Material.getMaterial(name);
if (type == null || type.isBlock()) {
plugin.getLogger().log(Level.WARNING, "{0} is not a valid item name", name);
return;
}
EntityEquipment equipment = entity.getEquipment();
equipment.setItemInHand(new ItemStack(type));
equipment.setItemInHandDropChance(worldConfig.getInt(Config.FEATURE_ZOMBIE_WEAPON_DROP_CHANCE) / 100.0f);
}
ZombieWeaponListener.java 文件源码
项目:BloodMoon
阅读 21
收藏 0
点赞 0
评论 0
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onStop(BloodMoonEndEvent event) {
World world = event.getWorld();
if (plugin.isFeatureEnabled(world, Feature.ZOMBIE_WEAPON)) {
for (LivingEntity entity : world.getLivingEntities()) {
if (entity.getType() == EntityType.ZOMBIE) {
EntityEquipment equipment = entity.getEquipment();
equipment.setItemInHand(null);
equipment.setItemInHandDropChance(0.0f);
}
}
}
}
EquipmentMenu.java 文件源码
项目:ArmorStandEditor
阅读 17
收藏 0
点赞 0
评论 0
private void fillInventory(){
menuInv.clear();
EntityEquipment equipment = armorstand.getEquipment();
ItemStack helmet = equipment.getHelmet();
ItemStack chest = equipment.getChestplate();
ItemStack pants = equipment.getLeggings();
ItemStack feetsies = equipment.getBoots();
ItemStack rightHand = equipment.getItemInMainHand();
ItemStack leftHand = equipment.getItemInOffHand();
equipment.clear();
ItemStack disabledIcon = new ItemStack(Material.BARRIER);
ItemMeta meta = disabledIcon.getItemMeta();
meta.setDisplayName(pe.plugin.getLang().getMessage("disabled", "warn")); //equipslot.msg <option>
ArrayList<String> loreList = new ArrayList<String>();
loreList.add(Util.encodeHiddenLore("ase icon"));
meta.setLore(loreList);
disabledIcon.setItemMeta(meta);
ItemStack helmetIcon = createIcon(Material.LEATHER_HELMET, "helm");
ItemStack chestIcon = createIcon(Material.LEATHER_CHESTPLATE, "chest");
ItemStack pantsIcon = createIcon(Material.LEATHER_LEGGINGS, "pants");
ItemStack feetsiesIcon = createIcon(Material.LEATHER_BOOTS, "boots");
ItemStack rightHandIcon = createIcon(Material.WOOD_SWORD, "rhand");
ItemStack leftHandIcon = createIcon(Material.SHIELD, "lhand");
ItemStack[] items =
{ helmetIcon, chestIcon, pantsIcon, feetsiesIcon, rightHandIcon, leftHandIcon, disabledIcon, disabledIcon, disabledIcon,
helmet, chest, pants, feetsies, rightHand, leftHand, disabledIcon, disabledIcon, disabledIcon
};
menuInv.setContents(items);
}
EntityWrapper.java 文件源码
项目:PlotSquared-Chinese
阅读 23
收藏 0
点赞 0
评论 0
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);
}
}
EntityListener.java 文件源码
项目:StarQuestCode
阅读 23
收藏 0
点赞 0
评论 0
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);
}
DroneShocktroop.java 文件源码
项目:StarQuestCode
阅读 20
收藏 0
点赞 0
评论 0
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);
}
EntityWrapper.java 文件源码
项目:PlotSquared
阅读 19
收藏 0
点赞 0
评论 0
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);
}
EntityWrapper.java 文件源码
项目:PlotSquared
阅读 23
收藏 0
点赞 0
评论 0
void storeEquipment(EntityEquipment equipment) {
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
this.lived.mainHand = equipment.getItemInMainHand().clone();
this.lived.offHand = equipment.getItemInOffHand().clone();
} else {
this.lived.mainHand = equipment.getItemInHand().clone();
this.lived.offHand = null;
}
this.lived.boots = equipment.getBoots().clone();
this.lived.leggings = equipment.getLeggings().clone();
this.lived.chestplate = equipment.getChestplate().clone();
this.lived.helmet = equipment.getHelmet().clone();
}
RemoteBaseEntity.java 文件源码
项目:remote-entities-nxt
阅读 19
收藏 0
点赞 0
评论 0
/**
* Copies the inventory from the given player to the inventory of this entity.
*
* @param inPlayer Player to copy inventory from
* @param inIgnoreArmor If armor should not be copied or if it should
*/
public void copyInventory(Player inPlayer, boolean inIgnoreArmor)
{
this.copyInventory(inPlayer.getInventory());
EntityEquipment equip = this.getBukkitEntity().getEquipment();
if(!inIgnoreArmor)
equip.setArmorContents(inPlayer.getInventory().getArmorContents());
if(this.getInventory() instanceof CraftInventoryPlayer)
((CraftInventoryPlayer)this.getInventory()).setHeldItemSlot(inPlayer.getInventory().getHeldItemSlot());
else
equip.setItemInHand(inPlayer.getItemInHand());
}
RemoteBaseEntity.java 文件源码
项目:EndHQ-Libraries
阅读 16
收藏 0
点赞 0
评论 0
/**
* Copies the inventory from the given player to the inventory of this entity.
*
* @param inPlayer Player to copy inventory from
* @param inIgnoreArmor If armor should not be copied or if it should
*/
public void copyInventory(Player inPlayer, boolean inIgnoreArmor)
{
this.copyInventory(inPlayer.getInventory());
EntityEquipment equip = this.getBukkitEntity().getEquipment();
if(!inIgnoreArmor)
equip.setArmorContents(inPlayer.getInventory().getArmorContents());
if(this.getInventory() instanceof CraftInventoryPlayer)
((CraftInventoryPlayer)this.getInventory()).setHeldItemSlot(inPlayer.getInventory().getHeldItemSlot());
else
equip.setItemInHand(inPlayer.getItemInHand());
}
NucleusKit.java 文件源码
项目:NucleusFramework
阅读 17
收藏 0
点赞 0
评论 0
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());
}
CreatureSpawnListener.java 文件源码
项目:Wayward
阅读 22
收藏 0
点赞 0
评论 0
@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));
}
}
}
}
}
SpawnListener.java 文件源码
项目:tregmine
阅读 21
收藏 0
点赞 0
评论 0
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);
}