Scoreboard Not Appearing

Discussion in 'Plugin Development' started by techboy291, Apr 30, 2013.

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

    techboy291

    Hi,


    So I'm trying to create a basic Scoreboard that counts a player's kills. I'm not getting any errors, yet the Scoreboard isn't displaying. Code:

    Code:
    @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event) {
            Player player = event.getPlayer();
            Scoreboard sb = getServer().getScoreboardManager().getNewScoreboard();
            sb.registerNewObjective("showkills", "totalKillCount");
            Objective kills = sb.getObjective("showkills");
            kills.setDisplayName("Kills: ");
            kills.setDisplaySlot(DisplaySlot.SIDEBAR);
            player.setScoreboard(sb);
            player.sendMessage("Test");
        }
    The test message works, but everything else doesn't. Ideas?
     
  2. Offline

    Tzeentchful

    techboy291
    It's not showing up because there are no items in the objective. You will need to add something to it for the scoreboard to show up.
     
  3. Offline

    techboy291

    Oh, I see. Sorry, I'm a little new to the Scoreboard API.

    Edit: Okay, it's working fine now. Thanks!
     
Thread Status:
Not open for further replies.

Share This Page