Solved Scoreboard not showing for player

Discussion in 'Spigot Plugin Development' started by Dramatically, Apr 1, 2020.

  1. I have this code, it does not work and I do not know why.
    Code (Text):

    private void showBoard(Player player, List<String> translated) {
        Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
        Objective objective = scoreboard.registerNewObjective("pwScoreboard", "dummy");
        objective.setDisplaySlot(DisplaySlot.SIDEBAR);
        objective.setDisplayName(ChatColor.translateAlternateColorCodes('&',
                PlaceholderAPI.setPlaceholders(player, title)));
        for (String s : translated) {
            objective.getScore(ChatColor.translateAlternateColorCodes('&', s));
        }
        player.setScoreboard(scoreboard);
    }
     
    I confirmed the method is ran so why does not show and when I do /scoreboard objectives list it says there are no objectives.
     
  2. Can confirm was solved by setting a score, I made the for loop iterate through the length of the list so it would be like 15,14,13,12...