Solved List of factions

Discussion in 'Plugin Development' started by ProMCKingz, Feb 20, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    ProMCKingz

    Hey,
    I have never used the factions API before, and would like to know how I could send a list of factions (maybe in an array) in chat.
    Thanks,
     
  2. Offline

    candyfloss20

  3. Offline

    ProMCKingz

    @candyfloss20
    I have used that, however cannot find a way to list all factions in chat.
    getAll method is unknown
     
  4. Offline

    candyfloss20

    @ProMCKingz
    Get the factions VIA id?
    Something like this
    Code:
    List<Faction> factions = new ArrayList<Faction>();
    factions.clear();
    for (int i = 0; i < numOfFactions; i++) {
        factions.add(//Faction that has the ID of i)
    }
     
  5. Offline

    ProMCKingz

  6. Offline

    candyfloss20

    @ProMCKingz
    I've never used the FactionsAPI myself.
    Is there not a method to get the number of factions inside the FactionColl interface?
     
  7. Offline

    ProMCKingz

    @candyfloss20
    There is FactionColl.get().init
    But i'm not sure what that exactly does
     
  8. Offline

    Totom3

  9. Offline

    ProMCKingz

    @Totom3
    That does not exist either
     
  10. Offline

    candyfloss20

    @ProMCKingz
    So what is it that you want to do?
    Simply list the factions EG: (Faction1, Faction2, Fac3, ......) ?
     
  11. Offline

    ProMCKingz

    @candyfloss20
    yeah.. list it per line in chat w/ player.sendMessage
     
  12. Offline

    candyfloss20

  13. Offline

    Totom3

    @ProMCKingz Oh sorry, my bad. Actually FactionColl.get().getAll() should work... Perhaps you are building against an outdated version? The method should be there. FactionColl extends Coll which has the method getAll().
     
    ProMCKingz likes this.
  14. Offline

    ProMCKingz

    @Totom3
    hmh. I downloaded the latest version and I don't get the getAll method, let me retry
    EDIT: New version works with it. So I do something like this?
    So how would I make it send all of the factions per line?
     
    Last edited: Feb 20, 2015
  15. Offline

    candyfloss20

    @ProMCKingz
    Iterate over all the factions and then send that factions name
    Code:
    for(Faction fac : getAllFactions)  {
       p.sendMessage(//Get Faction name fac.getName()?);
    }
     
    Last edited: Feb 20, 2015
    ProMCKingz likes this.
  16. Offline

    ProMCKingz

    @candyfloss20
    Ok thanks, will try that in game later

    @candyfloss20
    Thanks, it works!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
    candyfloss20 likes this.
  17. Offline

    candyfloss20

Thread Status:
Not open for further replies.

Share This Page