The SwissTeams API is somehow extremely simple and extremely complex at the same time.
It is designed to be used by SwissMP developers to create plugins that interact with SwissTeams.
BountyTransaction’s will be added soon once the API has been updated to add them.
How do I use it?
Initialize the API:
import dev.jimster.swissteams.api.TeamAPI;
...
public class MyPlugin extends JavaPlugin {
TeamAPI teamAPI;
@Override
public void onEnable() {
// Initialize the API
this.teamAPI = SwissTeams.getApi();
}
}
Example, check if player is in a team and get their team name:
import dev.jimster.swissteams.api.TeamAPI;
import org.bukkit.entity.Player;
public class MyListener implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
boolean isInTeam = teamAPI.isInTeam(player.getUniqueId());
if (isInTeam) {
player.sendMessage("You are in a team!");
Team team = teamAPI.getTeam(player.getUniqueId());
player.sendMessage("Your team name is: " + team.getName());
} else {
player.sendMessage("You are not in a team.");
}
}
}
Api Methods
| Property | Type | Description |
|---|
getUsername(UUID) | String | Get a players username from the Player Cache |
getPlayerCache() | HashMap<UUID, String> | Return the FULL Player Cache (not recommended) |
getUUID(String) | UUID | Get a players UUID from their username |
getBounties(UUID) | List<Bounty> | Returns a single bounty. Don’t ask why its a list |
hasBounties(UUID) | boolean | Check if a player has any bounties |
getAllBounties() | List<Bounty> | Return ALL bounties (not recommended) |
getTeam(UUID) | Team | Get a players team |
isInTeam(UUID) | boolean | Check if a player is in a team |
getAllTeams() | List<Team> | Returns ALL team (not recommended) |