Created
April 18, 2014 14:49
-
-
Save aikar/11047980 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EmpireScoreboard { | |
static Scoreboard scoreboard; | |
public static void initialize() { | |
scoreboard = Bukkit.getScoreboardManager().getNewScoreboard(); | |
} | |
public static Team getTeam(Player player) { | |
return Util.getMetadata(player, TempMetaKey.PLAYER_SCOREBOARD_TEAM); | |
} | |
public static void registerTeam(Player player) { | |
final Team team = scoreboard.registerNewTeam(player.getName()); | |
Util.setMetadata(player, TempMetaKey.PLAYER_SCOREBOARD_TEAM, team); | |
player.setScoreboard(scoreboard); | |
team.addPlayer(player); | |
} | |
public static void disbandTeam(Player player) { | |
Team team = getTeam(player); | |
team.removePlayer(player); | |
team.unregister(); | |
} | |
public static void setPlayerListName(Player player) { | |
getTeam(player).setPrefix(EmpireGroup.getGroup(player).color); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment