Spigot MultiScoreboard ?

Discussion in 'Spigot Plugin Development' started by ricosw, Jul 12, 2015.

  1. Hello,
    i have a problem with scoreboards i have make 2 scoreboards the first scoreboard create teams and put every player to the TabList with there color and the secound scoreboard create a sidebar[​IMG]
    [​IMG]

    But if i use both together it only show's the sidebar

    Tablist:
    Code (Text):
    private void prefix(Player p, String prefix) {
            String pr = prefix.replace("&", "§").replace("_", " ");

            Team t = sb.getTeam(prefix);

            if (t == null) {
                t = sb.registerNewTeam(prefix);
                t.setPrefix(pr);
            }
            t.addPlayer(p);

            for (Player all : Bukkit.getOnlinePlayers()) {
                all.setScoreboard(sb);
            }
        }
    Sidebar:
    Code (Text):
    private void sidebar(Player p) {
           
            Scoreboard board = manager.getNewScoreboard();
           
            Objective score = board.registerNewObjective("objective", "dummy");
           
            score.setDisplayName("§a§lSplashCraft §eNetzwerk");
            score.setDisplaySlot(DisplaySlot.SIDEBAR);
            score.getScore(Bukkit.getOfflinePlayer("§b§lServer")).setScore(11);
            score.getScore(Bukkit.getOfflinePlayer(Lobby.getBackend().getServerId().toUpperCase())).setScore(10);
            score.getScore("                 ").setScore(9);
            score.getScore(Bukkit.getOfflinePlayer("§e§lCoins")).setScore(8);
            score.getScore(Bukkit.getOfflinePlayer("0")).setScore(7);
            score.getScore("   ").setScore(6);
            score.getScore(Bukkit.getOfflinePlayer("§6§lRang")).setScore(5);
            score.getScore(Bukkit.getOfflinePlayer(new BackendPlayer(p).getGroup().toUpperCase())).setScore(4);
            score.getScore(" ").setScore(3);
            score.getScore(Bukkit.getOfflinePlayer("§c§lWebsite")).setScore(2);
            score.getScore(Bukkit.getOfflinePlayer("www.splashcraft.de")).setScore(1);
            score.getScore(Bukkit.getOfflinePlayer("---------------")).setScore(0);
           
            p.setScoreboard(board);
        }
     
  2. Don't create two scoreboards. Use the same scoreboard for the teams and create the sidebar objective from that scoreboard.
     
    • Agree Agree x 1
  3. But if i use
    Code (Text):
    for (Player all : Bukkit.getOnlinePlayers()) {
                all.setScoreboard(sb);
            }
    the sidebar will show to all players the same but i don't want that.

    if i use only
    Code (Text):
    p.setScoreboard(sb);
    [​IMG]
    The "Rang" is now wrong

    I want to update the sidebar only for the player who joined the game
     
    #3 ricosw, Jul 12, 2015
    Last edited: Jul 12, 2015
  4. The thing in the tablist is no scoreboard, it's a new 1.8 feature, you can send it to the client using packets.
     
  5. Have you an example for me?
     
  6. There are lots of libs that do this for you and it's also a feature in bungeecord's api.
    Just google it, I'm sure there are already lots of threads explaining it.
     
    • Like Like x 1
  7. Okay thanks!
     
    • Friendly Friendly x 1
  8. You need to create a scoreboard for each user that joins, and then when someone joins you need to loop over everyone who is online and modify there scoreboard teams to add the user who just joined
     
    • Agree Agree x 1