Scoreboard Help

Discussion in 'Plugin Development' started by ibWill, Jul 20, 2013.

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

    ibWill

    How would i make a scoreboard show an individual player his/her stats like Deaths? I know how to make it global but i cant make it player specific. Can someone help?
     
  2. Offline

    rippin

    An easy way I did this was I created a new object that handled the scoreboard and passed the player in the constructor. I had a method called setup in the class which set the scores for all objectives and just created an instance of the object and called the setup method in the PlayerJoinEvent listener.
     
  3. Offline

    Compressions

    ibWill You can save the player's data through a listener to the config and retrieve that data for your scoreboard method that may be invoked in the onEnable() method.
     
  4. Offline

    StrangeOne101

    https://forums.bukkit.org/threads/tutorial-scoreboards-teams-with-the-bukkit-api.139655/
    From that I got this:
    Code:
    ScoreboardManager manager =  Bukkit.getScoreboardManager();
          org.bukkit.scoreboard.Scoreboard board = manager.getNewScoreboard();
            Objective objective = board.registerNewObjective("deaths", "dummy");
          objective.setDisplayName("Player Info");
          objective.setDisplaySlot(DisplaySlot.SIDEBAR);
          Score score = objective.getScore(Bukkit.getOfflinePlayer(ChatColor.RED + "Deaths:")); /
          score.setScore(this.deathCount);
          player.setScoreboard(board);
    Then just make deathCount increase everytime the player dies.
     
  5. Offline

    Compressions

    StrangeOne101 If you're going to assist someone, make sure you show all fields; deathCount is not displayed in your snippet.
     
  6. Offline

    StrangeOne101

    Compressions What do you mean it's not displayed in the snippet? I didn't show it being initialized, I know, but it should be fairly obvious. If I'm no help, then fine.
     
  7. Offline

    Compressions

    StrangeOne101 Still, the Bukkit Forums is full of beginners that need every piece of the puzzle to grasp knowledge.
     
  8. Offline

    StrangeOne101

    Compressions I know that. And if they need any extra help, I'm willing to give it.
     
  9. Offline

    Compressions

    StrangeOne101 Okay, but how convenient would it be to give it to them without them asking :p
     
  10. Offline

    chasechocolate

    ibWill for per-player scoreboards, use a HashMap<String, Scoreboard>.
     
Thread Status:
Not open for further replies.

Share This Page