Solved Scoreboard max rows is 6

Discussion in 'Plugin Development' started by Minemakki, Oct 25, 2020.

  1. Offline

    Minemakki

    Hello!

    Why does my scoreboard only shows 6 first rows of Scores?

    Scoreboard_Spawn.java
    Code:
    package Scoreboards;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.scoreboard.DisplaySlot;
    import org.bukkit.scoreboard.Objective;
    import org.bukkit.scoreboard.Score;
    import org.bukkit.scoreboard.Scoreboard;
    import org.bukkit.scoreboard.ScoreboardManager;
    
    public class Scoreboard_Spawn {
    
        // Scoreboard for player joining server
        public void SB_S (String Username) {
         
        ScoreboardManager m = Bukkit.getScoreboardManager();
        Scoreboard Spawn = m.getNewScoreboard();
     
        Objective o = Spawn.registerNewObjective("Testi1", "Testi2", "Testi3");
        o.setDisplaySlot(DisplaySlot.SIDEBAR);
        o.setDisplayName(ChatColor.DARK_AQUA + "┬žlArena 1v1");
     
        // Player stats
        Score Kills = o.getScore(ChatColor.WHITE + "Kills: " + ChatColor.GOLD + "123");
        Kills.setScore(15);
        Score Deaths = o.getScore(ChatColor.WHITE + "Deaths: " + ChatColor.GOLD + "32231");
        Deaths.setScore(14);
        Score KDA = o.getScore(ChatColor.WHITE + "KDA: " + ChatColor.GOLD + "1.87");
        KDA.setScore(13);
     
        // Empty rows
        Score Empty_Row = o.getScore("--------------");
        Empty_Row.setScore(12);
        Score Empty_Row2 = o.getScore("--------------");
        Empty_Row2.setScore(11);
     
        // Wins and losses
        Score Wins = o.getScore(ChatColor.WHITE + "Wins: " + ChatColor.GOLD + "9");
        Wins.setScore(10);
        Score Losses = o.getScore(ChatColor.WHITE + "Losses: " + ChatColor.GOLD + "0");
        Losses.setScore(9);
    
        // Test
        Score Test = o.getScore(ChatColor.WHITE + "Wins: " + ChatColor.GOLD + "9");
        Test.setScore(8);
        Score Test1 = o.getScore(ChatColor.WHITE + "Losses: " + ChatColor.GOLD + "0");
        Test1.setScore(7);
    
    
        Player player = Bukkit.getServer().getPlayer(Username);
     
        // Set scoreboard for player
        player.setScoreboard(Spawn);
        }
    }
    
    
     

    Attached Files:

    • sb.PNG
      sb.PNG
      File size:
      3.7 KB
      Views:
      4
    Last edited: Oct 25, 2020
  2. Offline

    KarimAKL

    @Minemakki I believe scores have to be unique.
    For example:
    Code:Java
    1. Score Empty_Row = o.getScore("--------------");
    2. Empty_Row.setScore(12);
    3. Score Empty_Row2 = o.getScore("--------------");
    4. Empty_Row2.setScore(11);

    Has to be:
    Code:Java
    1. Score Empty_Row = o.getScore("1--------------");
    2. Empty_Row.setScore(12);
    3. Score Empty_Row2 = o.getScore("2--------------");
    4. Empty_Row2.setScore(11);

    You can make it look like there is no difference by using color codes, e.g. "---", "&r---", "&r&r---".
     
    Minemakki likes this.
  3. Offline

    Minemakki

    That was it. Thank you so much!
     
    Last edited: Nov 2, 2020
    KarimAKL likes this.

Share This Page