Scoreboard issue.

Discussion in 'Plugin Development' started by Fl1pzta, Jul 13, 2013.

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

    Fl1pzta

    I'm trying to add the prefix of the group they are in through permissions. I'm getting the meta properly, just it seems setDisplayName is making it look like every other player has the same prefix as the user. Any ideas on how I can create dynamic displayNames for each user?

    void createPlayerboard(Player player){

    Scoreboard newBoard = Scoreboardmanager.getNewScoreboard();
    Objective newObjective = newBoard.registerNewObjective("test", "dummy");
    newObjective.setDisplayName(prefix(player.getName()));
    newObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
    player.setScoreboard(newBoard);
    }
     
  2. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    The objective name (or displayname, if set) is the same for all users. Cannot be customized. You can put each player on a separate team and give them a prefix or suffix that's unique.
     
  3. Offline

    Fl1pzta

    mbaxter my bad for the double post, but what all is necessary when creating a scoreboard? If I'm just wanting to add a prefix on to players names through the player list shouldn't this work...

    Code:
        public void addPlayerPrefix(Player player){
            String prefix = getInfo(getGroup(player));
            if(groupExists(prefix)){
                Team thisTeam = newBoard.getTeam(prefix);
                thisTeam.addPlayer(player);
                player.setScoreboard(newBoard);
                return;
            }
            Team thisTeam = newBoard.registerNewTeam(prefix);
            thisTeam.setPrefix(convertString(prefix));
            thisTeam.addPlayer(player);
            player.setScoreboard(newBoard);
        }
        public boolean groupExists(String string){
            Team thisTeam = newBoard.getTeam(string);
            if(thisTeam==null){
                return false;
            }
            return true;
        }
    Do I need an objective still to define where the prefix is going even though apparently it can only go to Player list according to Bukkit's tutorial? Or am I just doing something wrong here. Thanks.
    Seems I spoke too soon. This works fine. Thanks!
     
  4. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Fl1pzta

    The team prefix value is what gets placed in front of player names overhead and in the tab list.
     
    stuntguy3000 likes this.
  5. Offline

    Fl1pzta

    mbaxter Is there a way to add multiple scoreboards to a player, but one in SideBar and one BelowName? All I saw on the Player class was .setScoreboard and .getScoreboard. Wouldn't .setScoreboard override the previous one?
     
  6. Offline

    stuntguy3000

    Yes it will..
     
  7. Offline

    chasechocolate

    Fl1pzta simply create two objectives with different DisplaySlots.
     
  8. Offline

    Fl1pzta

    chasechocolate Yeah, sorry for the late feedback. I think I got it.
     
Thread Status:
Not open for further replies.

Share This Page