[Solved] Getting a team's color

Discussion in 'Spigot Plugin Development' started by zombachu, Jul 14, 2015.

  1. Hi, is there a way to get the vanilla color of a team? AFAIK prefixes are handled by Bukkit and the color isn't stored there. Thanks in advance for the help!
    • Optimistic Optimistic x 1
  2. Hello there!
    Try checking for teams in the server's MainScoreboard. The method:
    Code (Java):
    should be the way to get your hands on it!

    I hope that's what you asked for. I'm not sure what you mean by AFAIK ^_^
    #2 Fedmand, Jul 14, 2015
    Last edited: Jul 14, 2015
    • Friendly Friendly x 1
  3. AFAIK = As far as I know

    That'll return the scoreboard, but I don't think there's a function to return the color (set by /scoreboard teams option <team> color <color>) of a team. Thanks for the help, though!
    • Friendly Friendly x 1
  4. There actually is a way!
    You can get all the teams or just one of them by using one of the following methods:
    Code (Java):
    board.getTeams() //returns all teams
    From there you can get a team's prefix by using:
    Code (Java):
    This returns a string, which should be the colourcode of that certain team's colour. I believe it is in the §# format, which means that §e would result in the team's colour being yellow.
    I that what you needed? :)
    #4 Fedmand, Jul 14, 2015
    Last edited: Jul 14, 2015
    • Winner Winner x 1
  5. Oh wow it works! I must've screwed up somewhere when I tried it the first time. Thanks for the help :D
    • Friendly Friendly x 1