Make PVP Scoreboard

Discussion in 'Plugin Development' started by Treeline1, Jan 10, 2015.

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

    Treeline1

    ATM im having a lot of trouble trying to find out how to make a scoreboard that displays kills/deaths etc. Now, im not the greatest at java so I cant just look at 1 line of code and go "Ahh I know now!"
    So if someone could help that would be great
     
  2. Offline

    Krizeh

    Create a config file which stores a players kills/deaths.
    Then display the stats on a scoreboard.
     
  3. <Ignore> Answered above.
     
    Krizeh likes this.
  4. Offline

    Treeline1

    But how do you display it? I know thats how you theoretically do it but I dont know how to put it into action
     
  5. Offline

    Krizeh

  6. Code:
    Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
    Objective statsObj = scoreboard.registerNewObjective("stats", "dummy");
    statsObj.setDisplaySlot(DisplaySlot.SIDEBAR); // Can't remember exactly what it's called.
    statsObj.setDisplayName("Statistics");
    statsObj.getScore("Kills").setScore(playerKills);
    // Do same with deaths.
    player.setScoreboard(scoreboard);
    
    http://jd.bukkit.org/dev/apidocs/org/bukkit/scoreboard/Scoreboard.html
    http://jd.bukkit.org/dev/apidocs/org/bukkit/scoreboard/Objective.html
     
Thread Status:
Not open for further replies.

Share This Page