Stella API
##Stella API
The StellaAPI exposes static methods to interact with Stella from your own plugin — query teams, manage members, edit team properties and check membership, all without creating an instance.
Players are identified by UUID throughout the API. Use StellaAPI.resolvePlayer(name) to turn a name into a UUID, and StellaAPI.getPlayerName(uuid) for the reverse.
###Installation
Add the JitPack repository and the dependency. Replace the version with the latest published tag.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.33drygo</groupId>
<artifactId>Stella</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>Then declare Stella as a dependency in your plugin.yml:
name: MyPlugin
main: com.example.MyPlugin
version: 1.0
depend: # use soft-depend instead if Stella is optional
- stella###StellaAPI Methods
All methods are static on dev.drygo.stella.api.StellaAPI.
Mutating methods (create/delete/set/add/remove) fire Bukkit events and must be called from the main thread. The player-team events are cancellable, so a mutation can return false if a listener cancels it.
Team queries
####
Returns a team by its id, orTeam getTeam(String id)nullif it doesn't exist.
Team red = StellaAPI.getTeam("red");
Player queries
####
The player's highest-priority team, orTeam getMainTeam(UUID player)nullif they're in none.
Team main = StellaAPI.getMainTeam(player.getUniqueId());####
List<Team> getPlayerTeams(UUID player)Every team the player belongs to, highest priority first.
####
boolean isInTeam(UUID player, String teamId)Whether the player is a member of a specific team.
####
boolean isInAnyTeam(UUID player)Whether the player belongs to at least one team.
####
UUID resolvePlayer(String name)Resolves a name to a UUID (online, cached, or known offline), or
null.####
String getPlayerName(UUID player)The last known name for a UUID, or
null.
Team mutations
####
Creates a team and returns it. ReturnsTeam createTeam(String id, int priority)nullif the id is invalid or already in use. FiresTeamCreateEvent.
Team team = StellaAPI.createTeam("red", 10);####
boolean deleteTeam(String id)Deletes a team. Returns
falseif it didn't exist. FiresTeamDeleteEvent.####
boolean setColor(String teamId, String color)Sets the team's hex color (
#RRGGBB). Returnsfalseif the team is unknown.####
boolean setDisplayName(String teamId, String displayName)Sets the team's display name.
####
boolean setPriority(String teamId, int priority)Sets the team's priority.
Membership mutations
####
Adds a player to a team. Returnsboolean addMember(String teamId, UUID player)falseif the team/player is invalid, the player is already a member, or a listener cancelledPlayerJoinTeamEvent.
StellaAPI.addMember("red", player.getUniqueId());####
Removes a player from a team. Returnsboolean removeMember(String teamId, UUID player)falseif the team/player is invalid, the player isn't a member, or a listener cancelledPlayerLeaveTeamEvent.
###Team Model
The dev.drygo.stella.team.Team object exposes:
| Method | Returns | Notes |
|---|---|---|
getId() |
String |
The team id (always lowercase). |
getDisplayName() |
String |
The display name. May contain color codes. |
getColor() |
String |
Hex color, e.g. #FF5555. |
getPriority() |
int |
Higher = more important. |
getMembers() |
Set<UUID> |
Member UUIDs. |
Prefer the
StellaAPImutators (setColor,addMember, …) over theTeamsetters — they persist toteams.yml, fire events and refresh hooks. Mutating theTeamdirectly does none of that.
###Stella Events
All events live in dev.drygo.stella.api.event and are handled with normal Bukkit listeners.
Click to expand
####
Cancellable. Fired before a player is added to a team.PlayerJoinTeamEvent
@EventHandler
public void onJoin(PlayerJoinTeamEvent event) {
UUID player = event.getPlayer();
Team team = event.getTeam();
// event.setCancelled(true); // to veto the membership
}####
Cancellable. Fired before a player is removed from a team.PlayerLeaveTeamEvent
@EventHandler
public void onLeave(PlayerLeaveTeamEvent event) {
UUID player = event.getPlayer();
Team team = event.getTeam();
}####
Fired after a team is created. Not cancellable.TeamCreateEvent
@EventHandler
public void onCreate(TeamCreateEvent event) {
Bukkit.getLogger().info("Team created: " + event.getTeam().getId());
}####
Fired after a team is deleted. Not cancellable. TheTeamDeleteEventTeamsnapshot is still readable.
@EventHandler
public void onDelete(TeamDeleteEvent event) {
Bukkit.getLogger().info("Team deleted: " + event.getTeam().getId());
}###Notes
- All
StellaAPImethods are static — no instantiation needed. - Mutations persist to
teams.ymlautomatically and refresh the LuckPerms / Minecraft team hooks. getMainTeam/getPlayerTeamsresolve order bypriority(highest first); make priorities unique if exact ordering matters.- The player-team events fire before the change is applied and can be cancelled; the team create/delete events fire after and cannot.