Ejemplo n.º 1
0
 public void update(Boss boss, IronGolem g) {
   boss.setHealth((int) g.getHealth());
   g.setCustomName(
       ChatColor.translateAlternateColorCodes(
           '&', boss.getBossName() + " &8» &a" + (int) boss.getHealth() + " HP"));
   bossNames.put(g.getCustomName(), boss);
   bosses.put(boss.getConfigName(), boss);
 }
Ejemplo n.º 2
0
  @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());
    }
  }
Ejemplo n.º 3
0
  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;
  }