π Introduction
Welcome to the documentation for xTeamsAPI , an API designed to interact with the team system of the xTeams plugin. This API allows you to manage teams and players easily, delegating most tasks to the plugin's TeamManager . Here you will find a complete guide on how to implement it, along with a breakdown of each of its methods.
π Setup
π Requirements
To use xTeamsAPI , you need to have the xTeams plugin installed on your Minecraft server. This API is compatible with Minecraft versions that use Bukkit/Spigot.
βοΈ How to Implement xTeamsAPI
To start using the API, you first need to initialize it in your plugin class:
Copy javaCopyEditXTeamsAPI xTeamsAPI = new XTeamsAPI(plugin) ;
Where plugin is an instance of your main plugin class extending JavaPlugin .
π¦ Content
π§ Methods of xTeamsAPI
Below is a detailed explanation of each method provided by xTeamsAPI , along with examples of how to use them.
getPlayerTeamName(OfflinePlayer player) Description : Gets the name of the team that a player belongs to.
Parameters :
player
- The player whose team name you want to retrieve.
Return Value :
A String
representing the team name of the player.
Example :
Copy javaCopyEditString teamName = xTeamsAPI.getPlayerTeamName(player);
setDisplayName(String teamName, String newDisplayName) Description : Changes the visible name of a team.
Parameters :
teamName
- The name of the team.
newDisplayName
- The new display name you want to assign to the team.
Return Value :
true
if the operation was successful, false
otherwise.
Example :
Copy javaCopyEditboolean success = xTeamsAPI.setDisplayName("MyTeam", "New Display Name");
getPlayerTeamDisplayName(OfflinePlayer player) Description : Gets the visible name of the team that a player belongs to.
Parameters :
player
- The player whose team's display name you want to retrieve.
Return Value :
A String
representing the visible name of the player's team.
Example :
Copy javaCopyEditString displayName = xTeamsAPI.getPlayerTeamDisplayName(player);
getPlayerTeams(OfflinePlayer player) Description : Gets all the teams a player belongs to.
Parameters :
player
- The player whose teams you want to retrieve.
Return Value :
A list of Team
objects representing the teams the player is part of.
Example :
Copy javaCopyEditList<Team> teams = xTeamsAPI.getPlayerTeams(player);
isPlayerInTeam(OfflinePlayer player, String teamName) Description : Checks if a player is in a specific team.
Parameters :
player
- The player you want to check.
teamName
- The name of the team you want to check.
Return Value :
true
if the player is in the team, false
otherwise.
Example :
Copy javaCopyEditboolean isInTeam = xTeamsAPI.isPlayerInTeam(player, "MyTeam");
getTeamMembers(String teamName) Description : Gets all the members of a team.
Parameters :
teamName
- The name of the team.
Return Value :
A set of strings (Set<String>
) representing the player names of the team's members.
Example :
Copy javaCopyEditSet<String> members = xTeamsAPI.getTeamMembers("MyTeam");
listTeams() Description : Retrieves a list of all the teams in the system.
Return Value :
A list of strings (List<String>
) with the names of all teams.
Example :
Copy javaCopyEditList<String> teams = xTeamsAPI.listTeams();
getTeamByName(String teamName) Description : Gets a Team
object that contains all the information about a team.
Parameters :
teamName
- The name of the team you want to retrieve.
Return Value :
A Team
object with the information about the team.
Example :
Copy javaCopyEditTeam team = xTeamsAPI.getTeamByName("MyTeam");
createTeam(String teamName, String displayName, int priority, Set<String> members) Description : Creates a new team.
Parameters :
teamName
- The name of the new team.
displayName
- The visible name of the team.
priority
- The priority of the team.
members
- A set of players who will be members of the team.
Return Value :
This method does not return anything.
Example :
Copy javaCopyEditSet<String> members = new HashSet<>();
members.add("player1");
members.add("player2");
xTeamsAPI.createTeam("MyTeam", "Awesome Team", 1, members);
deleteTeam(String teamName) Description : Deletes a team from the system.
Parameters :
teamName
- The name of the team you want to delete.
Return Value :
This method does not return anything.
Example :
Copy javaCopyEditxTeamsAPI.deleteTeam("MyTeam");
joinTeam(OfflinePlayer player, String teamName) Description : Allows a player to join a team.
Parameters :
player
- The player who will join the team.
teamName
- The name of the team the player will join.
Return Value :
This method does not return anything.
Example :
Copy javaCopyEditxTeamsAPI.joinTeam(player, "MyTeam");
leaveTeam(OfflinePlayer player, String teamName) Description : Allows a player to leave a team.
Parameters :
player
- The player who will leave the team.
teamName
- The name of the team the player will leave.
Return Value :
This method does not return anything.
Example :
Copy javaCopyEditxTeamsAPI.leaveTeam(player, "MyTeam");
deleteAllTeams() escription : Deletes all teams from the system.
Return Value :
This method does not return anything.
Example :
Copy javaCopyEditxTeamsAPI.deleteAllTeams();
Last updated 3 months ago