Problem with Scoreboards :l

Discussion in 'Plugin Development' started by XvBaseballkidvX, Dec 6, 2013.

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

    XvBaseballkidvX

    Hello everyone!

    I am trying to use the BELOW_NAME scoreboard and I am having some trouble.
    (I looked over ChaseChocolates Scoreboard tutorial just to let you all know :p )

    CODE:
    Code:java
    1. public static void underNameScoreboard(Player player){
    2. ScoreboardManager manager = Bukkit.getScoreboardManager();
    3. Scoreboard board = manager.getNewScoreboard();
    4. Objective obj = board.registerNewObjective("dollars", "dummy");
    5. obj.setDisplayName("§6dollars");
    6. obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
    7. int bal = (int) Main.getInstance().econ.getBalance(player.getName());
    8. Score cash = obj.getScore(Bukkit.getOfflinePlayer(""));
    9. cash.setScore(bal);
    10. player.setScoreboard(board);
    11. }


    I used this code in a SIDEBAR scoreboard and it displayed the information correctly (The Scoreboard updates automatically every 2 seconds). I don't know why the BELOW_NAME scoreboard is doing this.

    Currently it displays: "0 dollars" even though the player has more.

    Thank you for reading!
    All help is much appreciated!
     
  2. Offline

    XvBaseballkidvX

    Bump?

    This is probably a little soon but, Bump.
    I would really like to get this accomplished today :3

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

    DailyLove

  4. Offline

    XvBaseballkidvX

    DailyLove Its on Line 7 lol

    Line 7:
    Code:java
    1. int bal = (int) Main.getInstance().econ.getBalance(player.getName());


    New Code:
    Code:java
    1. public static void underNameScoreboard(Player player){
    2. ScoreboardManager manager = Bukkit.getScoreboardManager();
    3. Scoreboard board = manager.getNewScoreboard();
    4. Objective obj = board.registerNewObjective("dollars", "dummy");
    5. int bal = (int) Main.econ.getBalance(player.getName());
    6. obj.setDisplayName("§6dollars");
    7. obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
    8. obj.getScore(Bukkit.getOfflinePlayer("Test")).setScore(bal);
    9. player.setScoreboard(board);
    10. }


    Same thing happens though :l
    If no one replies I won't bump this again lol.

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

    Wolfey

    Try asking chasechocolate?
     
  6. Offline

    XvBaseballkidvX

    Wolfey they are most likely busy, but I guess it wont hurt to ask.
    chasechocolate If you have the time, what do you think is wrong?
     
  7. Offline

    samosaara

    Lols. My scoreboard is completely different, I don't use and ScoreBoardManager object, instead I use this directly:
    Code:java
    1. Scoreboard board = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
    2. Objective objective = board.registerNewObjective("Points", "dummy");
    3. Score score = objective.getScore(Bukkit.getOfflinePlayer("Points: "));
    4.  
    5. //And I control the score trough this:
    6. score.setScore(10);
     
  8. Offline

    XvBaseballkidvX

    samosaara Where are you setting the Display_Slot?
    If its the Sidebar, the code that I posted works, for some odd reason it wont work for the Below_Name scoreboard!!!
    Im not sure if its a bug, or a mistake on my part.
     
  9. Offline

    samosaara

  10. Offline

    XvBaseballkidvX

    samosaara Yes I mean that :3
    And his code is for the sidebar scoreboard.
     
  11. Offline

    L33m4n123

    I have read somewhere that there is a bug with the scoreboard below names that it is buggy, For the Health for example it shows always 0 until they get damaged
     
  12. Offline

    XvBaseballkidvX

    L33m4n123 Do you think it would work with packets?
     
  13. Offline

    L33m4n123

    No Idea. Never really worked with Scoreboards
     
Thread Status:
Not open for further replies.

Share This Page