-
Notifications
You must be signed in to change notification settings - Fork 14
Scoreboard Teams
There are several methods to utilize the power of scoreboard teams in the library. All scoreboard types utilize the same team system, and the methods are not different between them.
This does mean that Scoreboard teams are not displayed per-player. If this is a feature you need, you can always access the raw Bukkit Scoreboard by calling the toBukkitScoreboard method on any instance of JScoreboard (per player scoreboards require a specific player).
You create a team by using an instance of JScoreboard:
JScoreboardTeam team = scoreboard.createTeam(
"Team Name", // The internal name of the team. Can be used to find it later if you don't store a reference to it
"&c&lIT ", // The display name (prefix) of the team
ChatColor.RED // The color of the team. Will change the player's name color
);Then, you can add players to a team:
team.addPlayer(player);Additionally, you can add Entities to teams as well, either via a Bukkit Entity instance, or via a UUID:
team.addEntity(entity);Removing players or other entities is just as simple:
team.removePlayer(player);
team.removeEntity(entity);Please note that adding Entities to teams is not formally tested or supported. If there's a good use case for this, I'm happy to provide further support and testing.