### Ask a documentation question with GET request Source: https://ultimateteams.gitbook.io/ultimateteams-docs/llms.txt Use this HTTP GET request to ask a question about the documentation. The `ask` parameter is required and should be a specific, self-contained natural-language question; `goal` is optional and describes the broader end goal. The response contains a direct answer with relevant excerpts and sources. ```http GET https://ultimateteams.gitbook.io/ultimateteams-docs/setup.md?ask=&goal= ``` -------------------------------- ### Get a TeamPlayer and disable invites with CompletableFuture Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/using-the-api.md Shows how to get a TeamPlayer asynchronously and then handle the CompletableFuture. The first snippet returns a CompletableFuture; the second uses thenAccept to disable invites for the player and update the player data, sending a confirmation message. ```java public CompletableFuture getTeamPlayer(UUID uuid) { return teamsAPI.getTeamPlayer(uuid); } ``` ```java public void disableInvites(Player player) { teamsAPI.getTeamPlayer(player.getUniqueId()).thenAccept(teamPlayer -> { teamPlayer.getPreferences().setAcceptInvitations(false); teamsAPI.updatePlayer(teamPlayer); player.sendMessage("Players can't invite you now."); }); } ``` -------------------------------- ### Ask a documentation question with the `ask` parameter Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers Use this HTTP GET request to ask a specific question about the documentation. The `ask` parameter is required and should be a specific, self-contained natural language question. The optional `goal` parameter describes the broader end goal to tailor the answer. ```http GET https://ultimateteams.gitbook.io/ultimateteams-docs/commands-and-permissions.md?ask=&goal= ``` -------------------------------- ### Create UltimateTeamsHook class to get API instance Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/getting-an-instance-of-the-api.md Defines a hook class that obtains the UltimateTeamsAPI instance via UltimateTeamsAPI.getInstance(). Use this to avoid ClassNotFoundException if UltimateTeams is not installed. ```java import dev.xf3d3.ultimateteams.UltimateTeams; import dev.xf3d3.ultimateteams.api.UltimateTeamsAPI; public class UltimateTeamsHook { private final UltimateTeamsAPI teamsAPI; public UltimateTeamsHook() { this.teamsAPI = UltimateTeamsAPI.getInstance(); } } ``` -------------------------------- ### Bukkit plugin.yml with UltimateTeams softdepend Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/importing-the-api.md Example plugin.yml that declares UltimateTeams as a soft dependency. Use 'depend' instead if your plugin requires UltimateTeams to function. ```yaml name: ultimateteams-addon version: '1.0' main: dev.xf3d3.myplugin.MyPlugin api-version: '1.19' softdepend: # Or, use 'depend' instead - UltimateTeams ``` -------------------------------- ### Get a team by name with findTeamByName (Optional and ifPresentOrElse) Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/using-the-api.md Two ways to retrieve a team by name using the UltimateTeams API. The first uses Optional and manual presence checks; the second uses ifPresentOrElse for a more modern approach. Both print the team's balance if found, or a message if not. ```java public void getTeamByName(String teamName) { Optional optionalTeam = teamsAPI.findTeamByName(teamName); if (optionalTeam.isPresent()) { // You can now access the team object and modify it. Team team = optionalTeam.get(); System.out.println("The team " + team.getName() + " has a balance of: " + team.getBalance()); } else { System.out.println("The team " + teamName + " does not exist"); } } ``` ```java public void getTeamByName(String teamName) { teamsAPI.findTeamByName(teamName).ifPresentOrElse( team -> System.out.println("The team " + team.getName() + " has a balance of: " + team.getBalance()), () -> System.out.println("The team " + teamName + " does not exist") ); } ``` -------------------------------- ### Gradle repository configuration Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/importing-the-api.md Adds Maven Central and JitPack repositories to your Gradle build for resolving the UltimateTeams API. ```kotlin repositories { mavenCentral() maven { url 'https://jitpack.io' } } ``` -------------------------------- ### Use UltimateTeamsHook in main plugin class Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/getting-an-instance-of-the-api.md Shows how to instantiate the hook in onEnable() only if the UltimateTeams plugin is present, preventing ClassNotFoundException. ```java public final class UltimateteamsAddon extends JavaPlugin { private UltimateTeamsHook teamsAPI; @Override public void onEnable() { if (Bukkit.getPluginManager().getPlugin("UltimateTeams") != null) { this.teamsAPI = new UltimateTeamsHook(); } } @Override public void onDisable() { // Plugin shutdown logic } } ``` -------------------------------- ### Maven repository configuration Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/importing-the-api.md Adds the JitPack repository to your Maven pom.xml for resolving the UltimateTeams API. ```markup jitpack.io https://jitpack.io ``` -------------------------------- ### Send Message with Created Team Name (TeamCreateEvent) Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/listening-to-the-events.md Listens to TeamCreateEvent and sends a message to the creator with the team name. The comment shows the expected output when the name was modified to 'Dog'. ```java @EventHandler public void onTeamCreate(TeamCreateEvent event) { Player teamCreator = event.getUser(); teamCreator.sendMessage("The team name is: " + event.getTeam().getName()); // OUTPUT: The team name is: Dog } ``` -------------------------------- ### Modify Team Name on Creation (TeamPreCreateEvent) Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/listening-to-the-events.md Listens to TeamPreCreateEvent and changes the team name to 'Dog' if the original name is 'cat'. Uses event.setName() and sends a message to the creator. ```java import dev.xf3d3.ultimateteams.api.UltimateTeamsAPI; import dev.xf3d3.ultimateteams.api.events.TeamPreCreateEvent; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; public class UltimateTeamsHook implements Listener { private final UltimateTeamsAPI teamsAPI; public UltimateTeamsHook() { this.teamsAPI = UltimateTeamsAPI.getInstance(); } @EventHandler public void onTeamPreCreate(TeamPreCreateEvent event) { String teamName = event.getName(); Player teamCreator = event.getUser(); if (teamName.equalsIgnoreCase("cat")) { event.setName("Dog"); teamCreator.sendMessage("The team name has been modified to Dog"); } } } ``` -------------------------------- ### Gradle dependency declaration Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/importing-the-api.md Adds the UltimateTeams API as a dependency. Replace VERSION with the latest available version (v4.7.6). ```kotlin dependencies { implementation 'com.github.xF3d33:UltimateTeams:VERSION:api' } ``` -------------------------------- ### Cancel Team Creation on Banned Name (TeamPreCreateEvent) Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/listening-to-the-events.md Listens to TeamPreCreateEvent and cancels team creation if the name equals 'cat'. Uses UltimateTeamsAPI.getInstance() and sends a message to the creator. ```java import dev.xf3d3.ultimateteams.api.UltimateTeamsAPI; import dev.xf3d3.ultimateteams.api.events.TeamPreCreateEvent; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; public class UltimateTeamsHook implements Listener { private final UltimateTeamsAPI teamsAPI; public UltimateTeamsHook() { this.teamsAPI = UltimateTeamsAPI.getInstance(); } @EventHandler public void onTeamPreCreate(TeamPreCreateEvent event) { String teamName = event.getName(); Player teamCreator = event.getUser(); if (teamName.equalsIgnoreCase("cat")) { event.setCancelled(true); teamCreator.sendMessage("The team creation has been cancelled because you are using a banned name"); } } } ``` -------------------------------- ### Send Warp Coordinates to Team Members (TeamWarpSetEvent) Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/listening-to-the-events.md Listens to TeamWarpSetEvent and sends a message with the warp name and coordinates to all online team members. Note that coordinates are doubles and should be formatted to avoid long decimals. ```java import dev.xf3d3.ultimateteams.api.UltimateTeamsAPI; import dev.xf3d3.ultimateteams.api.events.TeamWarpSetEvent; import dev.xf3d3.ultimateteams.models.TeamWarp; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; public class UltimateTeamsHook implements Listener { private final UltimateTeamsAPI teamsAPI; public UltimateTeamsHook() { this.teamsAPI = UltimateTeamsAPI.getInstance(); } @EventHandler public void onWarpCreate(TeamWarpSetEvent event) { TeamWarp warp = event.getTeamWarp(); String message = "The team Owner has just created the warp " + warp.getName() + "\nCoordinates: X:" + warp.getWarpX() + ", Y:" + warp.getWarpY() + ", Z:" + warp.getWarpZ(); // send a message to all the online players event.getTeam().sendTeamMessage(message); } } ``` -------------------------------- ### Maven dependency declaration Source: https://ultimateteams.gitbook.io/ultimateteams-docs/developers/importing-the-api.md Adds the UltimateTeams API as a Maven dependency. Replace VERSION with the latest available version (v5.0). ```markup com.github.xF3d33 UltimateTeams VERSION api ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.