@SuppressWarnings("deprecation") public void spawn(Boss b) { Location spawn = b.getSpawn(); if (spawn != null && spawn.getWorld() != null) { IronGolem boss = (IronGolem) spawn.getWorld().spawnCreature(spawn, EntityType.IRON_GOLEM); boss.setMaxHealth(b.getHealth()); boss.setHealth(b.getHealth()); boss.setCanPickupItems(false); boss.setPlayerCreated(false); boss.setRemoveWhenFarAway(false); boss.setCustomNameVisible(true); boss.setCustomName( ChatColor.translateAlternateColorCodes( '&', b.getBossName() + " &8» &a" + (int) b.getHealth() + " HP")); bossNames.put(boss.getCustomName(), b); Util.spawnFirework(b.getSpawn()); Util.spawnFirework(b.getSpawn()); Util.spawnFirework(b.getSpawn()); } }
public Boss newBoss(Boss b) { String boss = b.getConfigName(); bosses.remove(boss); bossNames.remove(boss); FileConfiguration config = plugin.getConfigManager().getConfig("maps.yml"); ConfigurationSection section = config.getConfigurationSection(plugin.getMapManager().getCurrentMap().getName()); ConfigurationSection sec = section.getConfigurationSection("bosses"); Boss bb = new Boss( boss, sec.getInt(boss + ".hearts") * 2, sec.getString(boss + ".name"), Util.parseLocation( plugin.getMapManager().getCurrentMap().getWorld(), sec.getString(boss + ".spawn")), Util.parseLocation( plugin.getMapManager().getCurrentMap().getWorld(), sec.getString(boss + ".chest"))); bosses.put(boss, bb); return bb; }