Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Boss boss = Boss.get(is.getItemMeta().getDisplayName().replace(s.prefix, ""));
- LivingEntity ent = (LivingEntity) e.getPlayer().getLocation().getWorld().spawnEntity(e.getPlayer().getTargetBlock(null, 5).getLocation(), boss.getMobType());
- ent.setMaxHealth(boss.getMaxHP());
- ent.setHealth(boss.getMaxHP());
- ent.getEquipment().setArmorContents(boss.getArmor());
- ent.getEquipment().setItemInHand(boss.getItemInHand());
- for (String bs : boss.getPotionEffects()) {
- String[] ss = bs.split(" ");
- if (PotionEffectType.getByName(ss[0]) == null) continue;
- ent.addPotionEffect(new PotionEffect(PotionEffectType.getByName(ss[0]), Integer.parseInt(ss[1]) * 20, Integer.parseInt(ss[2]) - 1, true));
- }
- ent.getEquipment().setBootsDropChance(0);
- ent.getEquipment().setChestplateDropChance(0);
- ent.getEquipment().setLeggingsDropChance(0);
- ent.getEquipment().setHelmetDropChance(0);
- ent.setRemoveWhenFarAway(false);
- ent.setCustomName(boss.getName().replace("%hp%", String.valueOf((int) ent.getHealth()))
- .replace("%hpMax%", String.valueOf((int) ent.getMaxHealth()))
- .replace("%mobType%", ent.getType().toString())
- .replace("%serce%", "❤"));
- BossUtils.getSpawned().put(ent, boss);
- ItemStack hand = is.clone();
- hand.setAmount(1);
- e.getPlayer().getInventory().removeItem(hand);
- e.getPlayer().sendMessage(s.bossSpawnMsg.replace("%bossName%", boss.getRawName()).replace("%pName%", e.getPlayer().getName()));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement