Solved Scoreboard help

Discussion in 'Plugin Development' started by idkG0D, Feb 15, 2019.

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

    idkG0D

    Hello guys! I've maked a animated scoreboard and i need help with the tittle...
    I maked a BukkitRunnable to show the scoreboard title and when the title is complete, set title to ""; and restart this. But ok, everything working good, but before the text appear, he sow the color string (§) and i using the ChatColor.WHITE and ChatColor.RED in code...

    Print:
    http://prntscr.com/mlr5i7
    http://prntscr.com/mlr5pr

    code:


    Code:
     String title = ChatColor.WHITE+"FLASH"+ChatColor.RED+"MC";
            char[] split = title.toCharArray();
    
            new BukkitRunnable() {
                int counter = 0;
                String finaltitle = "";
    
                @Override
                public void run() {
    
                    if(counter < split.length) {
                        String letter = String.valueOf(split[counter]);
                        counter += 1;
                        String space = "";
                        for (int i = 0; i < split.length - counter; i++) {
                            space += " ";
                        }
    
                        finaltitle +=   letter;
                        obj.setDisplayName(finaltitle);
                    }else{
                        String space = "";
                        finaltitle = "";
                        for (int i = 0; i < split.length - counter; i++) {
                            space += "";
                        }
                        obj.setDisplayName(finaltitle);
                        counter = 0;
                    }
    
                }
            }.runTaskTimer(Main.pLugin, 0, 20);
    
            player.setScoreboard(board);
     
  2. ChatColor.WHITE and RED get converted into §f and §c. If your title won't change you could try checking if the character is a digit or '§' and then remove/add 2 chars instead of one
     
Thread Status:
Not open for further replies.

Share This Page