### Example: Display Town Name at Player Location Source: https://william278.net/docs/husktowns/api-v1 Shows how to get the town name at the player's location and display it, or indicate if they are in the wilderness. ```java String townName = HuskTownsAPI.getInstance().getTownAt(player.getLocation()); if (townName == null) { player.sendMessage("In wilderness") } else { player.sendMessage("You're standing in " + townName) } ``` -------------------------------- ### Conditional Placeholder Configuration Example Source: https://william278.net/docs/velocitab/conditional-placeholders An example configuration showing how to use a conditional relational placeholder to compare player health with target player health. ```yaml format: "" ``` -------------------------------- ### Spicord Configuration Example Source: https://william278.net/docs/huskchat/discord-hook Example of a Spicord `config.toml` file, showing bot settings and addon configuration. Ensure `huskchat` is added to the `addons` list for integration. ```toml name = "Server Chat" enabled = true token = "[YOUR TOKEN]" command_support = true command_prefix = "-" addons = [ "spicord::info", "spicord::plugins", "spicord::players", "huskchat" ] ``` -------------------------------- ### Start HuskTowns Legacy Migration Source: https://william278.net/docs/husktowns/legacy-migration Initiates the legacy data migration process from the console. Ensure all servers are offline and configuration parameters are correct before starting. ```bash husktowns migrate legacy ``` -------------------------------- ### Example: Display Player's Current Town Source: https://william278.net/docs/husktowns/api-v1 Shows how to get the name of the town a player is in and display it, or inform them if they are not in a town. ```java String townName = HuskTownsAPI.getInstance().getPlayerTown(player); if (townName == null) { player.sendMessage("You're not in a town") } else { player.sendMessage("You're a member of " + townName) } ``` -------------------------------- ### Creating an Instant Teleport Source: https://william278.net/docs/huskhomes/api-examples This example shows how to create and execute an instant teleport to a specific position on a server. ```APIDOC ## Creating an Instant Teleport This example shows how to create and execute an instant teleport to a specific position on a server. ```java public class HuskHomesAPIHook { private final HuskHomesAPI huskHomesAPI; // This teleports a player to 128, 64, 128 on the server "server" public void teleportPlayer(Player player) { OnlineUser onlineUser = huskHomesAPI.adaptUser(player); Position position = Position.at( 128, 64, 128, World.from("world", UUID.randomUUID()), "server" ); huskHomesAPI.teleportBuilder() .teleporter(onlineUser) // The person being teleported .target(position) // The target position .buildAndComplete(false); // This builds and executes the teleport instantly. } } ``` ``` -------------------------------- ### Example User Data JSON Dump Source: https://william278.net/docs/husksync/dumping-userdata This is an example of a user data snapshot dumped to a JSON file. It includes various data categories like statistics, experience, game mode, advancements, inventory, and health. ```json { "id": "209a56fd-efd0-4354-8f7c-e09f6d0673d8", "pinned": false, "timestamp": "2023-09-15T17:27:08.6768038+01:00", "save_cause": "DISCONNECT", "server": "alpha", "minecraft_version": "1.20.2", "platform_type": "bukkit", "format_version": 4, "data": { "husksync:statistics": "{\"generic\":{\"minecraft:fly_one_cm\":26261,\"minecraft:jump\":23,\"minecraft:leave_game\":3,\"minecraft:play_one_minute\":1904,\"minecraft:sneak_time\":7,\"minecraft:sprint_one_cm\":1849,\"minecraft:time_since_death\":1904,\"minecraft:time_since_rest\":1904,\"minecraft:total_world_time\":1904,\"minecraft:walk_one_cm\":414},\"blocks\":{},\"items\":{},\"entities\":{}}", "husksync:experience": "{\"total_experience\":0,\"exp_level\":0,\"exp_progress\":0.0}", "husksync:game_mode": "{\"game_mode\":\"CREATIVE\",\"allow_flight\":true,\"is_flying\":true}", "husksync:advancements": "[{\"key\":\"minecraft:recipes/decorations/crafting_table\",\"completed_criteria\":{\"unlock_right_away\":1694795225426}},{\"key\":\"minecraft:adventure/adventuring_time\",\"completed_criteria\":{\"minecraft:old_growth_birch_forest\":1694795225478}}]", "husksync:inventory": "{held_item_slot:0,items:{size:41}}", "husksync:ender_chest": "{size:27}", "husksync:potion_effects": "[]", "husksync:hunger": "{\"food_level\":20,\"saturation\":5.0,\"exhaustion\":0.449}", "husksync:health": "{\"health\":20.0,\"max_health\":20.0,\"health_scale\":20.0}" } } ``` -------------------------------- ### Getting HuskSync API Instance Source: https://william278.net/docs/husksync/API Demonstrates how to get the main HuskSync API instance and the Bukkit-extended instance. ```APIDOC ## Getting an instance of the API You can get the API instance by calling `HuskSyncAPI#getInstance()`. If targeting the Bukkit platform, you can also use `BukkitHuskSyncAPI#getBukkitInstance()` to get the Bukkit-extended API instance (recommended). ### Example Usage ```java import net.william278.husksync.api.HuskSyncAPI; import net.william278.husksync.bukkit.BukkitHuskSyncAPI; public class ApiHook { private final HuskSyncAPI huskSyncAPI; public ApiHook() { // Get the main API instance this.huskSyncAPI = HuskSyncAPI.getInstance(); // Or, for Bukkit-specific features: // HuskSyncAPI bukkitApi = BukkitHuskSyncAPI.getBukkitInstance(); } } ``` ``` -------------------------------- ### Creating a Custom Highlighter Source: https://william278.net/docs/huskclaims/highlighter-api Example implementation of the Highlighter interface for creating a custom claim highlighter. ```APIDOC ## Creating Your Own Highlighter ```java public class MyHighlighter implements Highlighter { @Override public void startHighlighting(OnlineUser user, World world, Collection toHighlight, boolean showOverlap) { // Highlight the supplied Highlightables in the supplied world for the supplied user } @Override public void stopHighlighting(OnlineUser user) { // Stop highlighting for the supplied user } @Override public short getPriority() { return 10; // OPTIONAL - Specify the priority of this highlighter. Higher priorities take precedence. } @Override public boolean canUse(OnlineUser user) { return true; // OPTIONAL - Return whether this highlighter can work for this user. } } ``` ``` -------------------------------- ### Use Regex for Server Matching Source: https://william278.net/docs/velocitab/Server-Groups Utilize regular expressions to dynamically include servers in a group. This example matches servers starting with 'lobby-' followed by digits. ```yaml servers: - ^lobby-\d+$ ``` -------------------------------- ### Creating a Timed Teleport Source: https://william278.net/docs/huskhomes/api-examples This example demonstrates creating a timed teleport to another online player, which executes after a warmup period. ```APIDOC ## Creating a Timed Teleport This example demonstrates creating a timed teleport to another online player, which executes after a warmup period. ```java public class HuskHomesAPIHook { private final HuskHomesAPI huskHomesAPI; // This performs a timed teleport to tp a player to another online player with the username "William278" public void teleportPlayer(Player player) { OnlineUser onlineUser = huskHomesAPI.adaptUser(player); Target targetUsername = Target.username("William278"); // Get a target by a username, who can be online on this server/a server on the network (cross-server teleport). try { huskHomesAPI.teleportBuilder() .teleporter(onlineUser) .target(targetUsername) .toTimedTeleport() // Instead of running buildAndComplete, we can get the Teleport object itself this way. .execute(); // A timed teleport will throw a TeleportationException if the player moves/takes damage during the warmup, or if the target is not found. } catch(TeleportationException e) { // Since this doesn't catch the TeleportException (buildAndComplete does!), we need to do this. // Use TeleportException#displayMessage() to display why the teleport failed to the user. e.displayMessage(onlineUser); } } } ``` ``` -------------------------------- ### Maven Dependency Setup Source: https://william278.net/docs/husksync/API Include this dependency in your pom.xml. Replace HUSKSYNC_VERSION and MINECRAFT_VERSION with appropriate values. Use 'provided' scope. ```xml net.william278.husksync husksync-PLATFORM HUSKSYNC_VERSION+MINECRAFT_VERSION provided ``` -------------------------------- ### Gradle Dependency Setup Source: https://william278.net/docs/husksync/API Add this dependency to your build.gradle. Replace HUSKSYNC_VERSION and MINECRAFT_VERSION with appropriate values. Use 'compileOnly' for provided scope. ```gradle dependencies { compileOnly 'net.william278.husksync:husksync-PLATFORM:HUSKSYNC_VERSION+MINECRAFT_VERSION' } ``` -------------------------------- ### Listening to PlayerAddedToTabEvent Source: https://william278.net/docs/velocitab/api-examples An example demonstrating how to listen for `PlayerAddedToTabEvent` and use the Velocitab API to set a custom player name. ```APIDOC ## Listening to PlayerAddedToTabEvent ### Description Listens for when a player is added to the TAB list and sets a custom name for them. ### Example ```java @Subscribe public void onPlayerAddedToTab(PlayerAddedToTabEvent event) { VelocitabAPI velocitabAPI = VelocitabAPI.getInstance(); velocitabAPI.setCustomPlayerName(event.player().getPlayer(), "CustomName"); } ``` ``` -------------------------------- ### Highlighter Interface Methods Source: https://william278.net/docs/huskclaims/highlighter-api The Highlighter interface requires implementations for starting and stopping highlighting, with optional methods for priority and usage checks. ```APIDOC ## Highlighter Interface ### Methods * `#startHighlighting(OnlineUser user, World world, Collection toHighlight, boolean showOverlap)` * **user** (`OnlineUser`): The user to highlight for. * **world** (`World`): The world to highlight in. * **toHighlight** (`Collection`): A collection of highlightable objects. * **showOverlap** (`boolean`): Whether to show overlapping claim selections. * `#stopHighlighting(OnlineUser user)` * **user** (`OnlineUser`): The user to stop highlighting for. * `#getPriority()` (Optional) * Returns the priority of this highlighter (`short`). Default: `10`. * `#canUse(OnlineUser user)` (Optional) * Returns whether the user can use this highlighter (`boolean`). Default: `true`. ``` -------------------------------- ### Getting a user's inventory contents Source: https://william278.net/docs/husksync/api-v2 Demonstrates how to retrieve and process a user's inventory items using HuskSyncAPI methods. ```APIDOC ## HuskSyncAPI#deserializeInventory() ### Description Deserializes Base 64 serialized inventory `ItemData` into an actual `ItemStack` array. ### Method `HuskSyncAPI#deserializeInventory(serializedItems)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java huskSyncAPI.deserializeInventory(inventoryData.serializedItems).join(); ``` ### Response #### Success Response (200) - **BukkitInventoryMap** (BukkitInventoryMap) - A map containing the user's inventory contents. #### Response Example ```java // Example of processing the returned BukkitInventoryMap BukkitInventoryMap inventory = huskSyncAPI.deserializeInventory(inventoryData.serializedItems).join(); for (ItemStack item : inventory.getContents()) { System.out.println(item.getType().name()); } ``` ``` ```APIDOC ## HuskSyncAPI#getPlayerInventory() ### Description Retrieves the player's inventory contents directly. ### Method `HuskSyncAPI#getPlayerInventory(user)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java huskSyncAPI.getPlayerInventory(user).thenAccept(inventory -> { if (inventory.isPresent()) { for (ItemStack item : inventory.get().getContents()) { System.out.println(item.getType().name()); } } }); ``` ### Response #### Success Response (200) - **Optional** (Optional) - An optional containing the user's inventory map if available. #### Response Example ```java // Example of processing the returned Optional huskSyncAPI.getPlayerInventory(user).thenAccept(inventory -> { if (inventory.isPresent()) { for (ItemStack item : inventory.get().getContents()) { System.out.println(item.getType().name()); } } }); ``` ``` ```APIDOC ## HuskSyncAPI#deserializeItemStackArray() ### Description Deserializes Base 64 serialized Ender Chest `ItemData` into an actual `ItemStack` array. ### Method `HuskSyncAPI#deserializeItemStackArray(serializedItems)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java huskSyncAPI.deserializeItemStackArray(serializedItems).join(); ``` ### Response #### Success Response (200) - **ItemStack[]** (ItemStack[]) - An array of ItemStacks representing the Ender Chest contents. #### Response Example ```java // Example of processing the returned ItemStack array ItemStack[] enderChestContents = huskSyncAPI.deserializeItemStackArray(serializedItems).join(); for (ItemStack item : enderChestContents) { System.out.println(item.getType().name()); } ``` ``` ```APIDOC ## HuskSyncAPI#getPlayerEnderChest() ### Description Retrieves the player's Ender Chest contents directly. ### Method `HuskSyncAPI#getPlayerEnderChest(user)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java huskSyncAPI.getPlayerEnderChest(user).thenAccept(enderChest -> { if (enderChest.isPresent()) { for (ItemStack item : enderChest.get()) { System.out.println(item.getType().name()); } } }); ``` ### Response #### Success Response (200) - **Optional** (Optional) - An optional containing an array of ItemStacks representing the Ender Chest contents if available. #### Response Example ```java // Example of processing the returned Optional huskSyncAPI.getPlayerEnderChest(user).thenAccept(enderChest -> { if (enderChest.isPresent()) { for (ItemStack item : enderChest.get()) { System.out.println(item.getType().name()); } } }); ``` ``` -------------------------------- ### Start Migration Process Source: https://william278.net/docs/husktowns/legacy-migration Begins the actual data migration after all parameters have been set and verified. This process can take several minutes. Admin claims will not be migrated and must be re-created. ```bash husktowns migrate legacy start ``` -------------------------------- ### Display Legacy Migration Help Source: https://william278.net/docs/husksync/legacy-migration Use this command in the console to view available options for the legacy migration. ```bash husksync migrate help legacy ``` -------------------------------- ### API Hook Class Example Source: https://william278.net/docs/huskclaims/api Create a dedicated class for interacting with the HuskClaims API to avoid ClassNotFoundExceptions if HuskClaims is not installed. ```java public class HuskClaimsAPIHook { public HuskClaimsAPIHook() { // Ready to do stuff with the API } } ``` -------------------------------- ### Start Legacy Migration Process Source: https://william278.net/docs/husksync/legacy-migration Execute this command to initiate the data migration from a legacy HuskSync version to v3.x. This process may take a significant amount of time depending on the data volume. ```bash husksync migrate start legacy ``` -------------------------------- ### Creating a home Source: https://william278.net/docs/huskhomes/api-examples Shows how to create a new home for a player at their current location using the `createHome` method. ```APIDOC ## createHome(owner, name, position) ### Description Creates a new home for a given owner with a specified name and position. ### Method `createHome(User owner, String name, Position position)` ### Parameters - **owner** (`User`) - The user who will own the new home. - **name** (`String`) - The name of the new home. - **position** (`Position`) - The position of the new home. ### Throws `ValidationException` - If the home creation fails due to validation errors (e.g., too many homes, invalid metadata). ### Example ```java try { huskHomesAPI.createHome(onlineUser, "example", onlineUser.getPosition()); } catch (ValidationException e) { owner.sendMessage("Failed to create home: " + e.getType()); } ``` ``` -------------------------------- ### Getting a user by UUID Source: https://william278.net/docs/husksync/api-v2 Retrieves a User object by their UUID. This object represents a user saved in the database. If you have an online BukkitPlayer object, you can adapt it to get an OnlineUser, which extends User. ```APIDOC ## Getting a user by UUID ### Description Retrieves a `User` object by their UUID. This object represents a user saved in the database. If you have an online `org.bukkit.Player` object, you can use `BukkitPlayer#adapt(player)` to get an `OnlineUser` (extends `User`), representing a logged-in user. ### Method Signature `HuskSyncAPI#getUser(uuid)` ### Example Usage ```java public class HuskSyncAPIHook { private final HuskSyncAPI huskSyncAPI; public HuskSyncAPIHook() { this.huskSyncAPI = HuskSyncAPI.getInstance(); } public void logUserName(UUID uuid) { // getUser() returns a CompletableFuture supplying an Optional huskSyncAPI.getUser(uuid).thenAccept(optionalUser -> { // Check if we found a user by that UUID either online or on the database if (optionalUser.isEmpty()) { // If we didn't, we'll log that they don't exist System.out.println("User does not exist!"); return; } // The User object has two fields; uuid and username. System.out.println("User name is: %s", optionalUser.get().username); }); } } ``` ``` -------------------------------- ### Get Claim Owner Name at Location Source: https://william278.net/docs/huskclaims/claims-api Retrieves and prints the owner's name for a claimed location. Ensure the location is claimed before attempting to get the owner's name. ```java void showClaimerNameAt(org.bukkit.Location location) { Position position = huskClaims.getPosition(location); Optional claim = huskClaims.getClaimAt(position); if (claim.isPresent()) { System.out.println("This location is claimed by " + huskClaims.getClaimOwnerNameAt(position).get()); } } ``` -------------------------------- ### Define Headers and Footers for Server Groups Source: https://william278.net/docs/velocitab/Server-Groups Configure a list of headers and footers that will cycle for a server group. Set the update rate in milliseconds. ```yaml headers: - 'Running Velocitab by William278 & AlexDev03' footers: - 'There are currently %players_online%/%max_players_online% players online' ``` -------------------------------- ### Display Target Player's Server Source: https://william278.net/docs/velocitab/relational-placeholders This example checks if the target player has the 'check.server' permission. If they do, it displays the server the audience player is currently on, using '%server%' as a MiniPlaceholder. ```plaintext ``` -------------------------------- ### Trust Levels Configuration Example Source: https://william278.net/docs/huskclaims/trust This is an example of the `trust_levels.yml` configuration file. It defines the structure and default trust levels available in HuskClaims. Modifying this file can lead to loss of existing trust levels. ```yaml # ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ # ┃ HuskClaims - Trust Levels ┃ # ┃ Developed by William278 ┃ # ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ # ┣╸ List of trust levels users & groups can be assigned to in claims # ┣╸ Config Help: https://william278.net/docs/huskclaims/trust/ ``` -------------------------------- ### Show MPDB Migration Help Source: https://william278.net/docs/husksync/mpdb-migration Use this command in the console to display help information for the MPDB migrator. Ensure MySQLPlayerDataBridge is installed. ```bash husksync migrate help mpdb ``` -------------------------------- ### Get OperationTypeRegistry Source: https://william278.net/docs/huskclaims/operations-api Retrieve the OperationTypeRegistry to access registered OperationTypes and the Handler. ```java void getRegistry() { final OperationTypeRegistry reg = huskClaims.getOperationTypeRegistry(); } ``` -------------------------------- ### TeleportWarmupEvent Source: https://william278.net/docs/huskhomes/api-events Called when a player starts a teleport warmup countdown. This event is cancellable. ```APIDOC ## TeleportWarmupEvent ### Description Called when a player starts a teleport warmup countdown. ### Cancellable Yes ``` -------------------------------- ### Gradle Dependency Setup Source: https://william278.net/docs/huskclaims/api Add this dependency to your build.gradle file. Replace PLATFORM with your target platform (e.g., 'bukkit', 'fabric') and VERSION with the HuskClaims version (e.g., '1.5+1.21.1'). ```gradle dependencies { compileOnly 'net.william278.huskclaims:huskclaims-PLATFORM:VERSION' } ``` -------------------------------- ### Getting TrustTags Source: https://william278.net/docs/huskclaims/trust-api Retrieve a list of all registered trust tags or a specific trust tag by its name. ```APIDOC ## Getting TrustTags You can get a list of registered trust tags using `HuskClaimsAPI#getTrustTags()`. You can get a `TrustTag` by name using `HuskClaimsAPI#getTrustTagByName(String name)`. * For example, use `#getTrustTagByName("public")` to get the built-in `PublicTrustTag` which you can use to grant public trust on a `Claim`. ### Example — Getting the list of registered TrustTags ```java void showTrustTags(org.bukkit.command.CommandSender sender) { sender.sendMessage("Registered trust tags: " + huskClaims.getTrustTags().stream() .map(TrustTag::getName).collect(Collectors.joining(", "))); } ``` ``` -------------------------------- ### Getting UserGroups Source: https://william278.net/docs/huskclaims/trust-api Retrieve a list of a user's created UserGroups or a specific UserGroup by its name. ```APIDOC ## Getting UserGroups You can get a list of a user's created `UserGroup`s using `HuskClaimsAPI#getUserGroups(User user)`. You can get a `UserGroup` by name using `HuskClaimsAPI#getUserGroupByName(User owner, String name)`. ### Example — Getting a user's created User Groups ```java void showUserGroups(org.bukkit.Player player) { final OnlineUser user = huskClaims.getOnlineUser(player); player.sendMessage("Registered user groups for " + user.getName() + ": " + huskClaims.getUserGroups(user).stream() .map(UserGroup::getName).collect(Collectors.joining(", "))); } ``` ``` -------------------------------- ### Gradle Dependency Setup Source: https://william278.net/docs/huskclaims/API Add this dependency to your build.gradle. Replace PLATFORM with 'bukkit' or 'fabric' and VERSION with the HuskClaims version (e.g., '1.5+1.21.1'). ```gradle dependencies { compileOnly 'net.william278.huskclaims:huskclaims-PLATFORM:VERSION' } ``` -------------------------------- ### Getting if a location is claimed Source: https://william278.net/docs/huskclaims/claims-api Check if a specific location is claimed and retrieve information about the claim and its owner. ```APIDOC ## Getting if a location is claimed ### Description Use `#isClaimAt(Position position)` to check if a location is claimed, or `#getClaimAt(Position position)` to retrieve the `Optional` at that location. You can also get the owner's name using `#getClaimOwnerNameAt(Position position)`. ### Method `#isClaimAt(Position position)` `#getClaimAt(Position position)` `#getClaimOwnerNameAt(Position position)` ### Parameters #### Path Parameters - **position** (Position) - Required - The position to check. ### Request Example ```java void showClaimerNameAt(org.bukkit.Location location) { Position position = huskClaims.getPosition(location); Optional claim = huskClaims.getClaimAt(position); if (claim.isPresent()) { System.out.println("This location is claimed by " + huskClaims.getClaimOwnerNameAt(position).get()); } } ``` ### Response #### Success Response (200) - **Optional** - The claim at the position, if present. - **Optional** - The owner name of the claim, if present. #### Response Example ```java // For getClaimAt: Optional claim = Optional.of(new Claim(...)); // For getClaimOwnerNameAt: Optional ownerName = Optional.of("PlayerName"); ``` ``` -------------------------------- ### Maven Dependency Setup Source: https://william278.net/docs/huskclaims/api Add this dependency to your pom.xml. Replace PLATFORM with your target platform (e.g., 'bukkit', 'fabric') and VERSION with the HuskClaims version (e.g., '1.5+1.21.1'). ```xml net.william278.huskclaims huskclaims-PLATFORM VERSION provided ``` -------------------------------- ### Get OperationTypeRegistry Source: https://william278.net/docs/huskclaims/operations-api Retrieves the OperationTypeRegistry, which contains all registered OperationTypes and provides access to the Handler class. ```APIDOC ## Get OperationTypeRegistry ### Description Get the `OperationTypeRegistry` with `HuskClaimsAPI#getOperationTypeRegistry`. ### Method ```java void getRegistry() ``` ### Code Example ```java final OperationTypeRegistry reg = huskClaims.getOperationTypeRegistry(); ``` ``` -------------------------------- ### Configure Legacy Migration Setting Source: https://william278.net/docs/husksync/legacy-migration Use this command to set specific configuration values for the legacy migration. Replace `` and `` with the appropriate parameters. ```bash husksync migrate set legacy ``` -------------------------------- ### Maven Repository Setup for HuskTowns API Source: https://william278.net/docs/husktowns/api-v1 Add this repository to your pom.xml to access HuskTowns dependencies. ```xml jitpack.io https://jitpack.io ``` -------------------------------- ### Get User by UUID Source: https://william278.net/docs/husksync/Data-Snapshot-API Retrieves a user by their UUID. Logs if the user does not exist. Requires a UUID to be provided. ```java huskSyncAPI.getUser(uuid).thenAccept(optionalUser -> { // Check if we found a user by that UUID either online or on the database if (optionalUser.isEmpty()) { // If we didn't, we'll log that they don't exist System.out.println("User does not exist!"); return; } // The User object provides methods for getting a user's UUID and username System.out.println("Found %s", optionalUser.get().getName()); }); ``` -------------------------------- ### Example: Player Town Membership Notification Source: https://william278.net/docs/husktowns/api-v1 Illustrates how to check if a player is in a town and send them a corresponding message. ```java boolean inTown = HuskTownsAPI.getInstance().isInTown(player); if (inTown) { player.sendMessage("You're a member of a town") } else { player.sendMessage("You're not a member of a town") } ``` -------------------------------- ### Start MPDB Migration Process Source: https://william278.net/docs/husksync/mpdb-migration Initiate the data migration from MPDB to HuskSync. This command may take a significant amount of time depending on the data volume. ```bash husksync migrate start mpdb ``` -------------------------------- ### Maven Dependency Setup Source: https://william278.net/docs/huskclaims/API Include this dependency in your pom.xml. Replace PLATFORM with 'bukkit' or 'fabric' and VERSION with the HuskClaims version (e.g., '1.5+1.21.1'). ```xml net.william278.huskclaims huskclaims-PLATFORM VERSION provided ``` -------------------------------- ### Gradle Repository Setup for HuskTowns API Source: https://william278.net/docs/husktowns/api-v1 Add this repository to your build.gradle file to access HuskTowns dependencies. ```gradle allprojects { repositories { maven { url 'https://jitpack.io' } } } ``` -------------------------------- ### Get Town Name Player is In Source: https://william278.net/docs/husktowns/api-v1 Retrieves the name of the town a Player is currently in. Returns null if the player is not in any town. ```java /** * Returns the name of the town the {@link Player} is currently in; null if they are not in a town * @param player {@link Player} to check. * @return the name of the town the {@link Player} is currently in; null if they are not in a town. */ String town = HuskTownsAPI.getInstance().getPlayerTown(Player player); ``` -------------------------------- ### Get HuskTowns API Instance Source: https://william278.net/docs/husktowns/api-v1 Obtain an instance of the HuskTownsAPI to access its methods. This is the entry point for API usage. ```java HuskTownsAPI.getInstance() ``` -------------------------------- ### Create a New Snapshot from Scratch Source: https://william278.net/docs/husksync/Data-Snapshot-API Build a custom snapshot with specific data using DataSnapshot.Builder. This allows setting various player attributes like inventory and health before saving. ```java // Create a new snapshot from scratch final DataSnapshot.Builder builder = huskSyncAPI.snapshotBuilder(); // Create an empty inventory with a diamond sword in the first slot final BukkitData.Items.Inventory inventory = BukkitData.Items.Inventory.empty(); inventory.setContents(new ItemStack[] { new ItemStack(Material.DIAMOND_SWORD) }); inventory.setHeldItemSlot(0); // Set the player's held item slot to the first slot // Use the builder to create, then pack, a new snapshot final DataSnapshot.Packed packed = builder .saveCause(SaveCause.API) // This is the default save cause, but you can change it if you want .setTimestamp(OffsetDateTime.now().minusDays(3)) // Set the timestamp to 3 days ago .setInventory(inventory) // Set the player's inventory .setHealth(BukkitData.Health.from(10, 20, 20)) // Set the player to having 5 hearts .buildAndPack(); // You can also call just #build() to get a DataSnapshot.Unpacked // Save the snapshot - This will save the snapshot to the database for a User huskSyncAPI.addSnapshot(user, packed); ``` -------------------------------- ### Configure Server Links in config.yml Source: https://william278.net/docs/velocitab/server-links Define server links to be displayed in the player pause menu. Each link requires a URL, a label (custom text or a built-in string like 'website' or 'bug_report'), and the server groups it should apply to. Use '*' to apply to all groups. ```yaml server_links: - url: 'https://william278.net/project/velocitab' label: 'website' groups: ['*'] - url: 'https://william278.net/docs/velocitab' label: 'Documentation' groups: ['*'] - url: 'https://github.com/William278/Velocitab/issues' label: 'bug_report' # This will use the bug report built-in label and also be shown on the player disconnect screen groups: ['*'] ``` -------------------------------- ### Getting the ClaimWorld for a World Source: https://william278.net/docs/huskclaims/claims-api Retrieve the `ClaimWorld` object associated with a Bukkit `World` to determine if it's protected by HuskClaims. ```APIDOC ## Getting the ClaimWorld for a World ### Description Claims are organized within `ClaimWorld`s. This method allows you to get the `ClaimWorld` for a given Bukkit `World`. ### Method `#getClaimWorld(World world)` ### Parameters #### Path Parameters - **world** (World) - Required - The Bukkit World object. ### Request Example ```java void showClaimWorld(org.bukkit.World world) { Optional claimWorld = huskClaims.getClaimWorld(world); if (claimWorld.isPresent()) { System.out.println("This world is protected by HuskClaims, and contains " + claimWorld.get().getClaimCount() + " claims!"); } } ``` ### Response #### Success Response (200) - **Optional** - The `ClaimWorld` object if the world is protected by HuskClaims, otherwise empty. ``` -------------------------------- ### Maven Dependency Setup Source: https://william278.net/docs/velocitab/api Include this dependency in your pom.xml. Replace 'VERSION' with the latest Velocitab version. The scope is 'provided' as Velocitab is expected to be present on the server. ```xml net.william278 velocitab VERSION provided ``` -------------------------------- ### Gradle Repository Setup Source: https://william278.net/docs/huskclaims/api Add this repository to your build.gradle file to access HuskClaims releases. For development builds, you can use the '/snapshots' URL, but this is not recommended for production. ```gradle allprojects { repositories { maven { url 'https://repo.william278.net/releases' } } } ```