Advertisement
Guest User

Untitled

a guest
May 30th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1.         Boss boss = Boss.get(is.getItemMeta().getDisplayName().replace(s.prefix, ""));
  2.         LivingEntity ent = (LivingEntity) e.getPlayer().getLocation().getWorld().spawnEntity(e.getPlayer().getTargetBlock(null, 5).getLocation(), boss.getMobType());
  3.         ent.setMaxHealth(boss.getMaxHP());
  4.         ent.setHealth(boss.getMaxHP());
  5.         ent.getEquipment().setArmorContents(boss.getArmor());
  6.         ent.getEquipment().setItemInHand(boss.getItemInHand());
  7.         for (String bs : boss.getPotionEffects()) {
  8.             String[] ss = bs.split(" ");
  9.             if (PotionEffectType.getByName(ss[0]) == null) continue;
  10.             ent.addPotionEffect(new PotionEffect(PotionEffectType.getByName(ss[0]), Integer.parseInt(ss[1]) * 20, Integer.parseInt(ss[2]) - 1, true));
  11.         }
  12.         ent.getEquipment().setBootsDropChance(0);
  13.         ent.getEquipment().setChestplateDropChance(0);
  14.         ent.getEquipment().setLeggingsDropChance(0);
  15.         ent.getEquipment().setHelmetDropChance(0);
  16.         ent.setRemoveWhenFarAway(false);
  17.         ent.setCustomName(boss.getName().replace("%hp%", String.valueOf((int) ent.getHealth()))
  18.                         .replace("%hpMax%", String.valueOf((int) ent.getMaxHealth()))
  19.                         .replace("%mobType%", ent.getType().toString())
  20.                         .replace("%serce%", "❤"));
  21.         BossUtils.getSpawned().put(ent, boss);
  22.         ItemStack hand = is.clone();
  23.         hand.setAmount(1);
  24.         e.getPlayer().getInventory().removeItem(hand);
  25.         e.getPlayer().sendMessage(s.bossSpawnMsg.replace("%bossName%", boss.getRawName()).replace("%pName%", e.getPlayer().getName()));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement