Solved Scoreboards?

Discussion in 'Plugin Development' started by MrNewbie, Mar 21, 2015.

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

    MrNewbie

    I'm making a minigame and I decided to have socoreboards to show who's alive.
    I came across a problem. Displaying an array list in a scoreboard?
     
  2. Offline

    sgavster

    @MrNewbie Explain.. What type of arraylist? What about the arraylist do you want to display? etc.
     
  3. Offline

    MrNewbie

    I need to display an arraylist of alive and dead players.
     
  4. Offline

    sgavster

    @MrNewbie Well, I would use an ArrayList<String> and store the players name, so I would do

    PHP:
    ArrayList<Stringplayers = new ArrayList<String>();


    String listOfPlayers "";
    for(
    String playerz players) {
    listOfPlayers listOfPlayers players " ".trim();
    }

    //use listOfPlayers in scoreboards
    Untested. If you have any questions I'm here
     
  5. Offline

    nverdier

  6. Offline

    sgavster

    @nverdier Could always do that too. :p

    Always better than me, I see xD
     
  7. Offline

    nverdier

    @sgavster I never said that. I just changed one word in your post. You still made the post. It's still completely valid, just a Set is more fit for the job.
     
  8. Offline

    sgavster

    @nverdier I was kidding, lol. I know. It was just a suggestion to make it better, I completely understand.
     
  9. Offline

    nverdier

  10. Offline

    MrNewbie

    How would I use this?
    I've tried,
    PHP:
    Score scoreDeaths objective.getScore(listOfPlayers);
    But that didn't work?
    I mean how would I do this
    Alive:
    MrNewbie
    DummyUser
    Dead:
    Deummt
     
    Last edited by a moderator: Mar 21, 2015
  11. Offline

    Konato_K

    @MrNewbie Please use the Edit button instead of double posting.

    Get a score per each player
     
  12. Offline

    MrNewbie

    ^^^
    How would I get score of all players then send every player that score?
    @Konato_K

    Edit:
    I want it like this,
    PHP:
    Minigame
    Alive
    :
    User1
    User2
    Dead
    :
    User3
    But in a scoreboard
     
  13. Offline

    uksspy

    @MrNewbie
    Couldn't you just iterate over the array and add each element to the scoreboard?
     
  14. Offline

    MrNewbie

    I was thinking about doing this,
    PHP:
     for (Player p plugin.players){
                 
    Score scoreDeaths objective.getScore(p.getName());
                
    scoreDeaths.setScore(0);
    }
    but how would I change the name of the score for each player?

    It worked!
    Case solved!

    -snip-
    Forgot :/ Sorry

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

    Konato_K

    @MrNewbie You can't change the name of the score? What do you mean.
     
  16. Offline

    MrNewbie

    I thought since they would be the same score name it wouldn't work.
    But it actually worked and shows if a player is alive or dead.
     
Thread Status:
Not open for further replies.

Share This Page