Scoreboard isn't displayed

Discussion in 'Plugin Development' started by mr_snake302, May 6, 2014.

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


    Hi! I need help! Please look at my code and say, that's wrong

    when player join - nothing meter... no logs, no crashes

    2. public class Hub extends JavaPlugin implements Listener{
    3. public static final Logger _log = Logger.getLogger("Minecraft");
    4. ScoreboardManager manager = Bukkit.getScoreboardManager();
    5. Scoreboard board = manager.getNewScoreboard();
    9. @Override
    10. public void onEnable() {
    11."[plugin] onEnable()");
    12. Bukkit.getPluginManager().registerEvents(this, this);
    13. ScoreboardManager manager = Bukkit.getScoreboardManager();
    14. Scoreboard board = manager.getNewScoreboard();
    15. }
    17. @EventHandler
    18. public void onJoin(PlayerJoinEvent event){
    19. ScoreboardManager manager = Bukkit.getScoreboardManager();
    20. Scoreboard board = manager.getNewScoreboard();
    21. Objective objective = board.registerNewObjective("test", "dummy");
    22. objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    23. objective.setDisplayName("Display Name");
    24. for(Player online : Bukkit.getOnlinePlayers()){
    25. online.setScoreboard(board);
    26. }
    27. }
    29. }[/syntax][/plugin]
  2. Offline


    First of all, you are defining the scoreboard three times, that is not neccesary.

    Now, what exactly do you want it to show here?
    You have not defined a score or something similar, (for example: kills, or health).

    As far as I've read (never used Scoreboard before, my apologies if I am wrong here), it should show up when a value updates/changes.
    Did you read this thread ? It explains how to give the scoreboard values and such.
  3. Dragoboss Don't forget the fact that 2/3 of those times are local variables. :p
    Dragoboss likes this.
  4. Offline


    AdamQpzm That's exactly what I meant. He defined it three times. 1 in the main class, 2 in the methods overriding the main class.
    Basically he initalizes the scoreboard twice on every time the server accesses his plugin file...
    AdamQpzm likes this.
Thread Status:
Not open for further replies.

Share This Page