How to display teams on scoreboards?

Discussion in 'Plugin Development' started by InflamedSebi, Oct 5, 2013.

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

    InflamedSebi

    I used his tut chasechocolate

    and created the folluwing code:
    Code:java
    1.  
    2. ScoreboardManager manager = Bukkit.getScoreboardManager();
    3. Scoreboard board = manager.getNewScoreboard();
    4.  
    5. Objective objective = board.registerNewObjective("data", "dummy"); // 16 chars
    6. objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    7. objective.setDisplayName("Headline"); // 32 chars
    8.  
    9. Team t = board.registerNewTeam("team1"); // 16 chars
    10. t.setDisplayName("teamname"); // 32 chars
    11. t.setPrefix("prefix");
    12. t.setSuffix("suffix");
    13.  
    14. OfflinePlayer p = Bukkit.getOfflinePlayer("offlineplayer");
    15. t.addPlayer(p);
    16.  
    17.  
    18. player.setScoreboard(board);


    this is part of and command ... so i do /slh sb and the code will run ...

    I expected it to show something like:
    Code:
    Headline
      teamname
        offlineplayer: 0
    or something similar ...
    but there is NO scoreboard ... nothing diplays ...
    If i add this:
    Code:java
    1.  
    2. // Score score = objective.getScore(p);
    3. // score.setScore(1337);


    i get:
    Code:
    Headline
    offlineplayer:    1337
    but still no teamname or something ....

    how do i display teamnames?
     
  2. Offline

    caseif

    Scoreboards don't do that. Teams are used for the purposes of displaying prefixes/suffixes, along with determining whether players can see certain other invisible players. As of 1.6.4, though, the only way to display team names would be to create a fake offline player and assign it a score which would cause it to be placed in the correct position. However, this doesn't always work, as sometimes scores simply don't work out that way.
     
Thread Status:
Not open for further replies.

Share This Page