Help with Teams

Discussion in 'Plugin Development' started by 360_, Jun 18, 2018.

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

    360_

    I'm trying to add a Prefix to a Scoreboard team but it seems that it won't work for some reason and I have no clue why. This is the code I'm using
    Code (open)

    Code:
    Scoreboard sc = Bukkit.getScoreboardManager().getMainScoreboard();
                        Team team1 = sc.getTeam("Owner");
                        if(team1 == null) {
                            team1 = sc.registerNewTeam("Owner");
                        }
                        team1.setPrefix(ChatColor.translateAlternateColorCodes('&', "&a[Prefix]"));
                        team1.addPlayer(p.getPlayer());
                        p.sendMessage("§7§oYour rank has been undated to §bOwner");
    and this is how it looks like ingame
    Image (open)
    [​IMG]
     
  2. Offline

    MightyOne

    Whats the rest of the event/whatever. I cant see the message "your rank...". Do you receive that message? Or where is your piece of code from?
     
  3. Offline

    360_

    @MightyOne This is the code from my onJoin
    Code:
    if (p.hasPermission("skyline.owner")) {
                        Scoreboard sc = Bukkit.getScoreboardManager().getMainScoreboard();
                        Team team1 = sc.getTeam("Owner");
                        if(team1 == null) {
                            team1 = sc.registerNewTeam("Owner");
                        }
                        team1.setPrefix(ChatColor.translateAlternateColorCodes('&', "&a[Prefix]"));
                        team1.addPlayer(p.getPlayer());
                        p.sendMessage("§7§oYour rank has been undated to §bOwner");
    
                    } else if (p.hasPermission("skyline.admin")) {
                        p.setPlayerListName("§8(§6Admin§8)§7 " + p.getName());
                        p.sendMessage("§7§oYour rank has been undated to §bAdmin");
    
                    } else if (p.hasPermission("skyline.cm")) {
                        p.setPlayerListName("§8(§3Cast Member§8)§7 " + p.getName());
                        p.sendMessage("§7§oYour rank has been undated to §bCM");
    
                    } else if (p.hasPermission("skyline.cp")) {
                        p.setPlayerListName("§8(§bIntern§8)§7 " + p.getName());
                        p.sendMessage("§7§oYour rank has been undated to §bCP");
    
                    } else if (p.hasPermission("skyline.beta")) {
                        p.setPlayerListName("§8(§bBeta§8)§7 " + p.getName());
                        p.sendMessage("§7§oYour rank has been undated to §bBeta");
    
                    } else {
                        p.setPlayerListName("§7" + p.getName());
                        p.sendMessage("§7§oYour rank has been undated to §bGuest");
    
                    }
     
Thread Status:
Not open for further replies.

Share This Page