Solved Help with scoreboard

Discussion in 'Plugin Development' started by SrNicks_, May 23, 2015.

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

    SrNicks_

    How to change a scoreboard or remove it ?
    I'm trying to use this code but when I run it removes more does not add again
    Code:
    
             Scoreboard sb = Bukkit.getScoreboardManager().getMainScoreboard();
              Team t = sb.getTeam(p.getName());
              if(t.getPlayers() == null){
                  t = sb.registerNewTeam(p.getName());
                  t.setPrefix(ChatColor.RED + "[Admin] ");        
              t.addPlayer(p);
              p.setScoreboard(sb);
              }else{
                 t.removePlayer(p);
                  t = sb.registerNewTeam(p.getName());
                   t.setPrefix(ChatColor.GREEN + "[Mod] ");        
               t.addPlayer(p);
               p.setScoreboard(sb);
              }
     
  2. Offline

    Timbals

  3. Offline

    SrNicks_

    @Timbals
    I've looked it does not tell how to take the player
     
  4. Offline

    Timbals

    @SrNicks_ what do you mean by "take the player"
     
  5. Offline

    SrNicks_

    @Timbals
    I want to remove the p.getName () the string t basically it
     
  6. @SrNicks_
    When the player joins setup a scoreboard for the player using ScoreboardManager#getNewScoreboard() and keep it into memory or call Player#getScoreboard(). Then edit stuff within there, don't use getMainScoreboard() if you want per-player scoreboards
     
  7. Offline

    SrNicks_

Thread Status:
Not open for further replies.

Share This Page