[1.8] Team prefix

Discussion in 'Spigot Plugin Development' started by Renamed, Jul 15, 2018.

Thread Status:
Not open for further replies.
  1. I need help adding a prefix to a team. I have been searching for around an hour now and couldn't find anything that was relevant or that worked. If someone could give me some prompts on what I should do/what i'm not doing, that would be great! Thanks in advance!

    My code:
    Code (Java):
        @SuppressWarnings("deprecation")
        public void addPrefix(Player p, String string, String position) {
         
            ScoreboardManager sb = Bukkit.getScoreboardManager();
            Scoreboard s = sb.getNewScoreboard();
            Objective o = s.registerNewObjective("Rank+", "dummy");
            Team t = s.registerNewTeam(string);
         
            if(position.equalsIgnoreCase("suffix")) {
             
                //Suffix
             
                t.setSuffix(string);
             
            } else {
             
                //Prefix
             
                t.setPrefix(string);
             
            }
         
            o.setDisplaySlot(DisplaySlot.SIDEBAR);
            t.addPlayer(p);
            p.setScoreboard(s);
         
        }

    EDIT: Never mind i'm dumb, fixed.
    SOLUTION: Had to add a for loop to loop through everyone online, and set their scoreboard to that.
     
Thread Status:
Not open for further replies.