Solved Teams not registering on scoreboard

Discussion in 'Plugin Development' started by Rixterz, Dec 23, 2015.

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

    Rixterz

    Hi,

    I am supposedly registering a variety of teams to the scoreboard. However, when iterating through the scoreboard's teams, nothing is returned.

    My code, which I've simplified to the basics, is:
    Code:
    Team tNullrMVP = board.registerNewTeam("tNullrMVP");
    tNullrMVP.setPrefix(ChatColor.AQUA + "");
    Team selectTeam = tNullrMVP;
    try{
         selectTeam.addEntry(p.getName());
    }catch(Exception e){
         p.sendMessage("error here");
    }
    The try statement of course captures the NullReferenceException. Every time this code is run, "error here" is displayed. Can anyone see where I've gone wrong? I'm hoping my use of BungeeCord doesn't affect access to scoreboards.

    -Rix
     
  2. Offline

    au2001

    @Rixterz The team probably already exists.

    Use board.getTeam(...), and if it is null then register the team.
     
  3. Offline

    Rixterz

    Actually it turns out i was unregistering all teams elsewhere :/

    thanks for the reply though
     
Thread Status:
Not open for further replies.

Share This Page