Example #1
0
  public List<GameSpawns> getTeamCoords(ChatColor color) {

    List<GameSpawns> teams = new ArrayList<GameSpawns>();
    for (GameSpawns team : this.spawnCoords) {
      if (team.getColor() == color) {
        teams.add(team);
      }
    }
    return teams;
  }
Example #2
0
  public Location getRandomSpawn(ChatColor color) {

    try {
      List<GameSpawns> coords = this.getTeamCoords(color);

      GameSpawns coordSpawn = null;

      if (coords.size() == 1) {
        coordSpawn = coords.get(0);
      } else {
        coordSpawn = coords.get(HyperPVP.getRandom().nextInt(coords.size()));
      }

      Location gameSpawn =
          new Location(this.world, coordSpawn.getX(), coordSpawn.getY(), coordSpawn.getZ());
      return gameSpawn;
    } catch (Exception e) {
      Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "reload");
    }
    return null;
  }