πŸ“šxTeams API

πŸ“„ 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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

javaCopyEditxTeamsAPI.leaveTeam(player, "MyTeam");
deleteAllTeams()

escription: Deletes all teams from the system.

Return Value:

  • This method does not return anything.

Example:

javaCopyEditxTeamsAPI.deleteAllTeams();

Last updated