Solved Score Board not showing first line

Discussion in 'Plugin Development' started by keeper317, Jan 5, 2015.

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

    keeper317

    I am trying to make a scoreboard that has 3 animations on it. One in the title that has 14 frames and two in the list that are the same that have 11 frames.
    I am updating the scores with these:
    Runnable Code (open)

    Code:
    public static void runUpdates(final Player p, final String rank, final String credit, final String token)
        {
            Main.taskID2 = Main.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(Main.plugin, new Runnable() {//Title
                  public void run() {
                      if(Main.SecondsToCountDown < 14)
                      {
                            try {
                                ScoreBoardHandler.updateBoard(p, Main.SecondsToCountDown, rank, credit, token);
                            } catch (IllegalArgumentException
                                    | IllegalStateException | SQLException e) {
                                Log.error(e.getMessage());
                            }
                          Main.SecondsToCountDown++;
                      }
                      else
                      {
                          Main.SecondsToCountDown = 1;
                         
                      }
                     
                  }
                }, 0L, 10L);
        }
        public static void runUpdates1(final Player p, final String rank, final String credit, final String tokens)
        {
            Main.taskID2 = Main.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(Main.plugin, new Runnable() {//Animation
                  public void run() {
                      if(Main.counter < 11)
                      {
                            try {
                                ScoreBoardHandler.updateBoard(p, counter, rank, credit, tokens);
                            } catch (IllegalArgumentException
                                    | IllegalStateException | SQLException e) {
                                Log.error(e.getMessage());
                            }
                          Main.counter++;
                      }
                      else
                      {
                          Main.counter = 1;
                         
                      }
                     
                  }
                }, 0L, 3L); // once each second
        }

    The title works but only the bottom animation works. This is the updater for the scoreboard and animation frames are:
    Scoreboard Updater and Animation frames (open)

    Code:
    public static void updateBoard(Player p, int frame, String rank, String credit, String tokens) throws IllegalArgumentException, IllegalStateException, SQLException
        {
            ScoreboardManager manager = Bukkit.getScoreboardManager();
            Scoreboard board = manager.getNewScoreboard();
            Objective obj = board.registerNewObjective("stats", "dummy");
            obj.setDisplaySlot(DisplaySlot.SIDEBAR);
            obj.setDisplayName(getCurrentTitleAnimation(frame));
            Score anim = obj.getScore("§6" + getAnimation(frame));
            anim.setScore(14);
            Score blank = obj.getScore( ("§2"));
            blank.setScore(12);
            Score title2 = obj.getScore(("§a§lRank:"));
            title2.setScore(11);
            Score Rank = obj.getScore(("§f" + rank));
            Rank.setScore(10);
            Score blank1 = obj.getScore(("§5"));
            blank1.setScore(9);
            Score title = obj.getScore(("§e§lCredits:"));
            title.setScore(8);
            Score credits = obj.getScore(("§f" + credit));
            credits.setScore(7);
            Score blank3 = obj.getScore(("§1"));
            blank3.setScore(6);
            Score title1 = obj.getScore(("§6§lTokens:"));
            title1.setScore(5);
            Score Tokens = obj.getScore(("§f" + tokens));
            Tokens.setScore(4);
            Score blank2 = obj.getScore(("§7"));
            blank2.setScore(3);
            Score title3 = obj.getScore(("§c§lWebsite:"));
            title3.setScore(2);
            Score url = obj.getScore(("§f" + Main.url));
            url.setScore(1);
            Score anim1 = obj.getScore("§6" + (getAnimation(frame)));
            anim1.setScore(0);
            p.setScoreboard(board);
        }
    public static String getAnimation(int frame)
        {
            String anim = "§6▁▂▃▄▅▆▆▅▄▃▂▁";
            switch (frame)
            {
                case 1: anim = "§6▂▃▄▅▆▆▅▄▃▂▁▂"; break;
                case 2: anim = "§6▃▄▅▆▆▅▄▃▂▁▂▃"; break;
                case 3: anim = "§6▄▅▆▆▅▄▃▂▁▂▃▄"; break;
                case 4: anim = "§6▅▆▆▅▄▃▂▁▂▃▄▅"; break;
                case 5: anim = "§6▆▆▅▄▃▂▁▂▃▄▅▆"; break;
                case 6: anim = "§6▆▅▄▃▂▁▂▃▄▅▆▆"; break;
                case 7: anim = "§6▅▄▃▂▁▂▃▄▅▆▆▅"; break;
                case 8: anim = "§6▄▃▂▁▂▃▄▅▆▆▅▄"; break;
                case 9: anim = "§6▃▂▁▂▃▄▅▆▆▅▄▃"; break;
                case 10: anim = "§6▂▁▂▃▄▅▆▆▅▄▃▂"; break;
                case 11: anim = "§6▁▂▃▄▅▆▆▅▄▃▂▁"; break;
            }
            return anim;
        }
     
  2. Offline

    nj2miami

    Scoreboard 0 & 14 are the same, add a 'ChatColor.GREEN + "" +' to one of those lines and it will show...however it will use up 3 of your characters for that line. Your alternative is change the color code for one of the lines.

    Also, you do not need to use text color codes, use ChatColor.COLOR...much easier :)
     
    keeper317 likes this.
  3. Offline

    keeper317

    Thanks cant believe i didnt think of that.
     
    nj2miami likes this.
Thread Status:
Not open for further replies.

Share This Page