### Get Request JsonObject with Error Logging Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/class-use/BStats.JsonObjectBuilder.JsonObject Constructs a JSON object for a request, with options for error logging. It accepts a BiConsumer for error handling and a boolean to control error logging. ```java BStats.JsonObjectBuilder.JsonObject getRequestJsonObject(BiConsumer errorLogger, boolean logErrors); ``` -------------------------------- ### Iterating Over Probability Elements (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/randomizer/ProbabilityCollection Provides an example of how to obtain an iterator to traverse the probability elements within the ProbabilityCollection. ```Java ProbabilityCollection collection = new ProbabilityCollection<>(); collection.add("A", 5); collection.add("B", 3); Iterator> iterator = collection.iterator(); while (iterator.hasNext()) { ProbabilityCollection.ProbabilitySetElement element = iterator.next(); System.out.println("Element: " + element.getObject() + ", Probability: " + element.getProbability()); } ``` -------------------------------- ### Get Chart Data as JsonObject Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/class-use/BStats.JsonObjectBuilder.JsonObject These methods retrieve chart data in the form of a BStats.JsonObjectBuilder.JsonObject. They are typically protected methods used internally by chart classes. ```java protected BStats.JsonObjectBuilder.JsonObject getChartData(); ``` -------------------------------- ### Getting Random Element from ProbabilityCollection (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/randomizer/ProbabilityCollection Shows how to retrieve a randomly selected element from the ProbabilityCollection based on the assigned weights. Throws IllegalStateException if the collection is empty. ```Java ProbabilityCollection collection = new ProbabilityCollection<>(); collection.add("A", 5); collection.add("B", 3); collection.add("C", 2); String randomElement = collection.get(); // Returns 'A', 'B', or 'C' based on probability ``` -------------------------------- ### Getting Total Probability in ProbabilityCollection (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/randomizer/ProbabilityCollection Retrieves the sum of all probability weights currently in the ProbabilityCollection. ```Java ProbabilityCollection collection = new ProbabilityCollection<>(); collection.add("A", 5); collection.add("B", 3); long totalProbability = collection.getTotalProbability(); // 8 ``` -------------------------------- ### BStats.SimpleBarChart Constructor Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.SimpleBarChart Initializes a new instance of the SimpleBarChart class. ```APIDOC ## SimpleBarChart Constructor ### Description Initializes a new instance of the SimpleBarChart class. ### Method CONSTRUCTOR ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "chartId": "string", "callable": "Callable>" } ``` ### Response #### Success Response (200) N/A (Constructor) #### Response Example N/A (Constructor) ``` -------------------------------- ### BStats Constructor Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats Creates a new Metrics instance for bStats integration. ```APIDOC ## BStats Constructor ### Description Creates a new Metrics instance for bStats integration. ### Method `BStats` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java new BStats(plugin, serviceId); ``` ### Response #### Success Response (200) N/A (Constructor) #### Response Example N/A (Constructor) ``` -------------------------------- ### SmallCapsUtils - componentToSmallCaps Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/format/SmallCapsUtils Converts an Adventure Component to small caps while preserving its formatting. ```APIDOC ## POST /utils/smallcaps/component ### Description Converts an Adventure Component to small caps, ensuring that any existing formatting within the component is maintained. ### Method POST ### Endpoint `/utils/smallcaps/component` ### Parameters #### Query Parameters - **input** (Component) - Required - The Adventure Component to convert to small caps. ### Request Body This endpoint does not require a request body. ### Request Example ```json { "input": { "text": "Hello ", "color": "red", "extra": { "bold": true } } } ``` ### Response #### Success Response (200) - **convertedComponent** (Component) - The input Adventure Component converted to small caps, with formatting preserved. #### Response Example ```json { "convertedComponent": { "text": "ʜᴇʟʟᴏ ", "color": "red", "extra": { "bold": true } } } ``` ``` -------------------------------- ### ExperienceManager API Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/experience/ExperienceManager Provides methods for managing player experience points and calculating levels. ```APIDOC ## ExperienceManager API ### Description This API allows for the management of player experience points (XP) within a Minecraft environment. It provides functionalities to retrieve current XP, calculate XP needed for specific levels, determine the current level from XP, and modify a player's XP. ### Methods #### `changeExp(Player player, int exp)` ##### Description Adds or removes player XP. This method is more accurate than Bukkit's `giveExp()` method. Negative values can be used to remove XP. ##### Method `static void` ##### Parameters * **player** (Player) - The player whose XP will be modified. * **exp** (int) - The amount of experience to add or remove. Use negative values to remove XP. ##### Request Example ```java ExperienceManager.changeExp(player, 100); ``` #### `getExp(Player player)` ##### Description Gets the player's total XP, including the progress toward the next level. ##### Method `static int` ##### Parameters * **player** (Player) - The player whose XP is to be retrieved. ##### Response * **XP** (int) - The total experience points of the player. ##### Response Example ```java int currentExp = ExperienceManager.getExp(player); ``` #### `getExpFromLevel(int level)` ##### Description Calculates the total XP required to reach a specified level starting from level 0. ##### Method `static int` ##### Parameters * **level** (int) - The target level. ##### Response * **XP** (int) - The total experience points needed to reach the specified level. ##### Response Example ```java int xpForLevel10 = ExperienceManager.getExpFromLevel(10); ``` #### `getIntLevelFromExp(long exp)` ##### Description Gets the integer level from a given amount of XP using binary search for efficient calculation. ##### Method `static int` ##### Parameters * **exp** (long) - The total experience points. ##### Response * **Level** (int) - The integer level corresponding to the provided XP. ##### Response Example ```java int playerLevel = ExperienceManager.getIntLevelFromExp(1500L); ``` #### `getLevelFromExp(long exp)` ##### Description Converts a given amount of XP to a level, including fractional progress toward the next level. ##### Method `static double` ##### Parameters * **exp** (long) - The total experience points. ##### Response * **Level** (double) - The level with fractional progress (e.g., 8.65 for level 8 with 65% progress to level 9). ##### Response Example ```java double playerPreciseLevel = ExperienceManager.getLevelFromExp(1500L); ``` ``` -------------------------------- ### DrilldownPie Constructor - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.DrilldownPie Initializes a new instance of the DrilldownPie class. Requires a chart identifier and a callable to provide chart data. ```java public DrilldownPie(String chartId, Callable>> callable) ``` -------------------------------- ### Convert Component to Small Caps - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Converts a Bukkit Component to its small caps representation while preserving the original formatting. This utility is useful for text styling in Minecraft. ```java SmallCapsUtils.componentToSmallCaps(Component component) ``` -------------------------------- ### ProbabilityCollection Constructor and Basic Operations (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/randomizer/ProbabilityCollection Demonstrates the creation of an empty ProbabilityCollection and basic operations like checking size, emptiness, and clearing the collection. ```Java ProbabilityCollection collection = new ProbabilityCollection<>(); boolean isEmpty = collection.isEmpty(); // true int size = collection.size(); // 0 collection.clear(); // Clears the collection ``` -------------------------------- ### MetricsBase Constructor - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.MetricsBase Initializes the MetricsBase class with various configuration parameters for metrics collection. It accepts consumers and suppliers for platform data, service data, task submission, service status checks, and logging. ```java public MetricsBase(String platform, String serverUuid, int serviceId, boolean enabled, Consumer appendPlatformDataConsumer, Consumer appendServiceDataConsumer, Consumer submitTaskConsumer, Supplier checkServiceEnabledSupplier, BiConsumer errorLogger, Consumer infoLogger, boolean logErrors, boolean logSentData, boolean logResponseStatusText) ``` -------------------------------- ### BStats.MultiLineChart Constructor Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.MultiLineChart Constructs a new MultiLineChart with the specified chart ID and data provider. ```APIDOC ## MultiLineChart Constructor ### Description Constructs a new MultiLineChart with the specified chart ID and data provider. ### Method CONSTRUCTOR ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "chartId": "string", "callable": "Callable>" } ``` ### Response #### Success Response (200) N/A (Constructor) #### Response Example N/A (Constructor) ``` -------------------------------- ### Logger API Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/logger/class-use/Logger.Level This section details the methods available for logging messages using different levels and contexts. ```APIDOC ## Logger API ### Description Provides methods for logging messages with various levels and optional player context or stack traces. ### Methods #### `log(Logger.Level level, Component message)` Logs a message at the specified level. - **Method**: `POST` (Assumed, as it modifies state) - **Endpoint**: `/log` (Assumed) - **Parameters**: - **Request Body**: - `level` (Logger.Level) - Required - The logging level. - `message` (Component) - Required - The message to log. #### `log(Logger.Level level, Component message, Throwable stackTrace)` Logs a message with stack trace at the specified level. - **Method**: `POST` (Assumed, as it modifies state) - **Endpoint**: `/log/stacktrace` (Assumed) - **Parameters**: - **Request Body**: - `level` (Logger.Level) - Required - The logging level. - `message` (Component) - Required - The message to log. - `stackTrace` (Throwable) - Required - The stack trace to include. #### `log(Player player, Logger.Level level, Component message)` Logs a message with player context at the specified level. - **Method**: `POST` (Assumed, as it modifies state) - **Endpoint**: `/log/player` (Assumed) - **Parameters**: - **Request Body**: - `player` (Player) - Required - The player context. - `level` (Logger.Level) - Required - The logging level. - `message` (Component) - Required - The message to log. ### Enum: Logger.Level Represents the different logging levels. #### `values()` Returns an array containing the constants of this enum class, in the order they are declared. - **Method**: `GET` (Assumed) - **Endpoint**: `/log/levels` (Assumed) #### `valueOf(String name)` Returns the enum constant of this class with the specified name. - **Method**: `GET` (Assumed) - **Endpoint**: `/log/level/{name}` (Assumed) - **Parameters**: - **Path Parameters**: - `name` (String) - Required - The name of the enum constant. ``` -------------------------------- ### BStats.SingleLineChart Constructor Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.SingleLineChart Constructs a new SingleLineChart with a given chart ID and a data provider. ```APIDOC ## POST /websites/javadoc_io_doc_in_arcadelabs_labaide_common-aide_1_3/BStats/SingleLineChart ### Description Constructs a new SingleLineChart with a given chart ID and a data provider. ### Method POST ### Endpoint /websites/javadoc_io_doc_in_arcadelabs_labaide_common-aide_1_3/BStats/SingleLineChart ### Parameters #### Request Body - **chartId** (String) - Required - Chart identifier - **callable** (Callable) - Required - Data provider ### Request Example { "chartId": "exampleChartId", "callable": "com.example.DataProvider" } ### Response #### Success Response (200) - **status** (String) - Indicates the success of the operation. #### Response Example { "status": "success" } ``` -------------------------------- ### SimplePie Constructor - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.SimplePie Initializes a new instance of the SimplePie class. It requires a chart identifier and a callable function to provide data for the chart. This constructor is part of the BStats library for creating custom charts. ```java public SimplePie(String chartId, Callable callable) ``` -------------------------------- ### Build JsonObject using BStats.JsonObjectBuilder Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/class-use/BStats.JsonObjectBuilder.JsonObject Demonstrates how to build a JSON object using the BStats.JsonObjectBuilder. This method is part of the BStats.JsonObjectBuilder class and returns a JsonObject instance. ```java BStats.JsonObjectBuilder.JsonObject jsonObject = BStats.JsonObjectBuilder.build(); ``` -------------------------------- ### BStats.addCustomChart() Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats Adds a custom chart to the bStats metrics. ```APIDOC ## addCustomChart(BStats.CustomChart chart) ### Description Adds a custom chart to the bStats metrics. ### Method `void` ### Endpoint N/A (Instance Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **chart** (BStats.CustomChart) - Required - The custom chart to add. ### Request Example ```java metrics.addCustomChart(new BStats.SimplePie("my_chart", () -> Collections.singletonMap("key", "value"))); ``` ### Response #### Success Response (200) N/A (Method returns void) #### Response Example N/A ``` -------------------------------- ### Logger.Level Enum Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/logger/Logger.Level Details about the Logger.Level enum, its constants, and available methods. ```APIDOC ## Enum: Logger.Level ### Description Represents the different logging levels available. ### Enum Constants * **DEBUG**: Represents the debug logging level. * **ERROR**: Represents the error logging level. * **INFO**: Represents the informational logging level. * **WARN**: Represents the warning logging level. ### Methods #### `static Logger.Level[] values()` Returns an array containing all the enum constants of this class, in the order they are declared. * **Returns**: An array of `Logger.Level` constants. #### `static Logger.Level valueOf(String name)` Returns the enum constant of this class with the specified name. * **Parameters**: * `name` (String) - The name of the enum constant to be returned. Must match exactly. * **Returns**: The `Logger.Level` constant with the specified name. * **Throws**: * `IllegalArgumentException`: If no constant with the specified name exists. * `NullPointerException`: If the provided name is null. ``` -------------------------------- ### AdvancedPie Constructor - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.AdvancedPie Initializes a new instance of the AdvancedPie class. It requires a unique chart identifier and a Callable that provides the data for the chart as a Map of Strings to Integers. This constructor is essential for setting up the chart with its ID and data source. ```java public AdvancedPie(String chartId, Callable> callable) ``` -------------------------------- ### SmallCapsUtils - stringToSmallCaps Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/format/SmallCapsUtils Converts a plain string to small caps. Non-letter characters remain unchanged. ```APIDOC ## POST /utils/smallcaps/string ### Description Converts a given string to small caps using Unicode characters. Non-alphabetic characters are preserved. ### Method POST ### Endpoint `/utils/smallcaps/string` ### Parameters #### Query Parameters - **input** (String) - Required - The string to convert to small caps. ### Request Body This endpoint does not require a request body. ### Request Example ```json { "input": "Hello World" } ``` ### Response #### Success Response (200) - **convertedString** (String) - The input string converted to small caps. #### Response Example ```json { "convertedString": "ʜᴇʟʟᴏ ᴡᴏʀʟᴅ" } ``` ``` -------------------------------- ### AdvancedBarChart Constructor - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.AdvancedBarChart Initializes a new instance of the AdvancedBarChart class. It requires a unique chart identifier and a callable that provides the data for the chart. The callable should return a Map where keys are strings and values are arrays of integers. ```java public AdvancedBarChart(String chartId, Callable> callable) ``` -------------------------------- ### Logger Class Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/logger/Logger The Logger class provides a utility for logging messages with support for different levels, prefixes, and player context. It integrates with the Adventure API and MiniMessage for rich text formatting. ```APIDOC ## Class: Logger ### Description Logging utility with Adventure API integration. Provides component-based logging with MiniMessage support and player context. Thread-safe for concurrent use. ### Package in.arcadelabs.labaide ### Version 1.3 ### Nested Classes * **`Logger.Level`** (enum): Represents the different logging levels. ### Constructor #### `Logger(String name, Component prefix, String serverPrefix, String playerPrefix)` Creates a new Logger instance. * **`name`** (String) - The name of the logger. * **`prefix`** (Component) - The component prefix for all messages. * **`serverPrefix`** (String) - The MiniMessage format for server messages. * **`playerPrefix`** (String) - The MiniMessage format for player messages. ### Methods #### `log(Logger.Level level, Component message)` Logs a message at the specified level. * **`level`** (Logger.Level) - The logging level. * **`message`** (Component) - The message to log. #### `log(Logger.Level level, Component message, Throwable stackTrace)` Logs a message with stack trace. * **`level`** (Logger.Level) - The logging level. * **`message`** (Component) - The message to log. * **`stackTrace`** (Throwable) - The throwable to include in the log. #### `log(Player player, Logger.Level level, Component message)` Logs a message with player context. Uses server prefix if player is null. * **`player`** (Player) - The player context for the log message. * **`level`** (Logger.Level) - The logging level. * **`message`** (Component) - The message to log. ``` -------------------------------- ### JsonObjectBuilder API Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.JsonObjectBuilder This section details the methods available in the JsonObjectBuilder class for creating JSON objects. ```APIDOC ## JsonObjectBuilder ### Description Provides methods to construct JSON objects by appending fields of various data types. ### Constructor #### `JsonObjectBuilder()` Initializes a new instance of the `JsonObjectBuilder` class. ### Methods #### `appendField(String key, String value)` Appends a string field to the JSON object. #### `appendField(String key, int value)` Appends an integer field to the JSON object. #### `appendField(String key, JsonObject object)` Appends a nested JSON object field to the JSON object. #### `appendField(String key, String[] values)` Appends an array of strings field to the JSON object. #### `appendField(String key, int[] values)` Appends an array of integers field to the JSON object. #### `appendField(String key, JsonObject[] values)` Appends an array of JSON objects field to the JSON object. #### `appendNull(String key)` Appends a null field to the JSON object. #### `build()` Builds and returns the final JSON object. ### Request Example ```json { "key": "value", "anotherKey": 123, "nestedObject": { "nestedKey": "nestedValue" }, "stringArray": ["a", "b", "c"], "intArray": [1, 2, 3], "objectArray": [ { "objKey1": "objValue1" }, { "objKey2": 456 } ], "nullField": null } ``` ### Response Example ```json { "message": "JSON object built successfully" } ``` ``` -------------------------------- ### JsonFetcher - Fetch JSON Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/json/package-summary Fetches JSON data from a given URL with a 5-second timeout and basic content type validation. ```APIDOC ## GET /fetch/json ### Description Fetches JSON data from a specified URL. It includes a 5-second timeout and validates that the response content type is 'application/json'. This method is suitable for quick, one-off API checks. ### Method GET ### Endpoint /fetch/json ### Parameters #### Query Parameters - **url** (string) - Required - The URL from which to fetch the JSON data. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **jsonData** (string) - The raw JSON string fetched from the URL. #### Response Example ```json { "jsonData": "{\"key\": \"value\"}" } ``` #### Error Response (400) - **error** (string) - Description of the error (e.g., Invalid URL, Timeout, Invalid Content Type). #### Error Response Example ```json { "error": "Invalid Content Type: Expected application/json but received text/plain" } ``` ``` -------------------------------- ### MetricsBase Fields and Methods - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.MetricsBase Defines key fields and methods for the MetricsBase class. METRICS_VERSION is a constant string representing the class version. addCustomChart allows adding custom charts, and shutdown performs cleanup operations. ```java public static final String METRICS_VERSION public void addCustomChart(BStats.CustomChart chart) public void shutdown() ``` -------------------------------- ### BStats.CustomChart Constructor (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.CustomChart The protected constructor for the BStats.CustomChart class, used for initializing a chart with a specific ID. It is intended for use by subclasses. ```java protected CustomChart(String chartId) ``` -------------------------------- ### BStats.AdvancedBarChart Constructor Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.AdvancedBarChart Constructs an AdvancedBarChart with a specified chart ID and a data provider. ```APIDOC ## AdvancedBarChart Constructor ### Description Constructs an AdvancedBarChart with a specified chart ID and a data provider. ### Method CONSTRUCTOR ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "chartId": "string", "callable": "Callable>" } ``` ### Response #### Success Response (200) This is a constructor, no direct response. #### Response Example N/A ``` -------------------------------- ### JsonFetcher - getJsonString Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/json/JsonFetcher Fetches a JSON string from a given URL with a 5-second timeout. This method is static and can be called directly on the JsonFetcher class. ```APIDOC ## GET /fetchJsonString ### Description Fetches a JSON string from a given URL with a 5-second timeout. ### Method GET ### Endpoint /fetchJsonString ### Parameters #### Query Parameters - **url** (URL) - Required - The URL from which to fetch the JSON string. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **jsonString** (String) - The fetched JSON string. #### Response Example { "jsonString": "{\"key\": \"value\"}" } #### Error Response (500) - **error** (String) - An error message indicating failure to fetch JSON. Throws: `IOException` - If an I/O error occurs during the fetch operation. ``` -------------------------------- ### BStats.SimpleBarChart.getChartData Method Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.SimpleBarChart Retrieves the chart data as a JsonObject. ```APIDOC ## GET /chartData ### Description Retrieves the chart data as a JsonObject. This method is inherited from BStats.CustomChart. ### Method GET ### Endpoint /chartData ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example N/A (GET request) ### Response #### Success Response (200) - **JsonObject** (BStats.JsonObjectBuilder.JsonObject) - The chart data in JSON format. #### Response Example ```json { "example": "JsonObject data" } ``` ``` -------------------------------- ### NameValidator - onlineCheck Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/validation/NameValidator Verifies username exists via Mojang API. Makes network request - use sparingly. ```APIDOC ## POST /api/namevalidator/onlineCheck ### Description Verifies username exists via Mojang API. Makes network request - use sparingly. ### Method POST ### Endpoint /api/namevalidator/onlineCheck ### Parameters #### Query Parameters - **username** (string) - Required - Username to verify. ### Request Example ```json { "username": "Player123" } ``` ### Response #### Success Response (200) - **exists** (boolean) - True if the username exists in Mojang database, false otherwise. #### Response Example ```json { "exists": true } ``` #### Error Response (500) - **error** (string) - Description of the network error (e.g., "Network error occurred") #### Error Example ```json { "error": "Network error occurred" } ``` ``` -------------------------------- ### Verify Minecraft Username via Mojang API (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/validation/NameValidator Verifies if a username exists in the Mojang database by making a network request to the Mojang API. Due to network usage, this method should be used sparingly. It throws an IOException if a network error occurs. ```java public static boolean onlineCheck(String username) throws IOException Verifies username exists via Mojang API. Makes network request - use sparingly. Parameters: `username` - username to verify Returns: true if username exists in Mojang database Throws: `IOException` - if network error occurs ``` -------------------------------- ### Build JSON Object - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Builds and returns the final JSON object from a BStats.JsonObjectBuilder instance. This method completes the JSON construction process. ```java build() ``` -------------------------------- ### BStats.shutdown() Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats Shuts down the bStats scheduler. ```APIDOC ## shutdown() ### Description Shuts down the bStats scheduler. ### Method `void` ### Endpoint N/A (Instance Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java metrics.shutdown(); ``` ### Response #### Success Response (200) N/A (Method returns void) #### Response Example N/A ``` -------------------------------- ### NameValidator API Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/validation/package-summary Provides methods for validating Minecraft usernames. It includes offline checks for format and Geyser prefixes, as well as an optional online check against the Mojang API. ```APIDOC ## NameValidator API ### Description Validates Minecraft usernames using offline format checks, Geyser prefix detection, or online Mojang API verification. ### Method This documentation describes a class with static methods, not a specific HTTP endpoint. The methods are called directly within your Java code. ### Endpoint N/A (Class-based validation) ### Parameters #### Offline Validation (Format and Geyser Prefix) - **username** (String) - Required - The Minecraft username to validate. #### Online Validation (Mojang API Lookup) - **username** (String) - Required - The Minecraft username to validate. - **onlineMode** (boolean) - Optional - If true, performs an online check against the Mojang API. Defaults to false. ### Request Example ```java // Offline validation boolean isValidOffline = NameValidator.validate(username); // Online validation (use with caution on main thread) boolean isValidOnline = NameValidator.validate(username, true); ``` ### Response #### Success Response - **isValid** (boolean) - True if the username is valid according to the specified checks, false otherwise. #### Response Example ```json { "isValid": true } ``` #### Error Handling - If `onlineMode` is true and the Mojang API is unreachable or returns an error, the validation might fail or throw an exception depending on the implementation details. - Invalid input types or null usernames may result in exceptions. ``` -------------------------------- ### Adding Elements to ProbabilityCollection (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/randomizer/ProbabilityCollection Shows how to add elements with specified probability weights to a ProbabilityCollection. Duplicates are allowed and contribute to the total weight. ```Java ProbabilityCollection collection = new ProbabilityCollection<>(); collection.add("Apple", 5); collection.add("Banana", 3); collection.add("Cherry", 2); // Duplicates are allowed and increase total weight collection.add("Apple", 2); ``` -------------------------------- ### JsonObject Class Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.JsonObjectBuilder.JsonObject Documentation for the JsonObject class, a simple JSON object wrapper for type safety, extending the Object class. ```APIDOC ## JsonObject Class ### Description A simple JSON object wrapper for type safety. ### Method Summary #### Instance Methods - `toString()`: String - Overrides the toString method from the Object class. ### Methods inherited from class Object - `clone` - `equals` - `finalize` - `getClass` - `hashCode` - `notify` - `notifyAll` - `wait` ### Method Details #### toString ```java public String toString() ``` Overrides: `toString` in class `Object` Returns a string representation of the JsonObject. ``` -------------------------------- ### Checking Element Existence in ProbabilityCollection (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/randomizer/ProbabilityCollection Illustrates how to check if an element exists within a ProbabilityCollection, ignoring its probability weight. ```Java ProbabilityCollection collection = new ProbabilityCollection<>(); collection.add("Apple", 5); boolean hasApple = collection.contains("Apple"); // true boolean hasGrape = collection.contains("Grape"); // false ``` -------------------------------- ### getChartData Method - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.AdvancedPie Retrieves the chart data in a JsonObject format. This method is overridden from the BStats.CustomChart class and is responsible for fetching and formatting the data required for rendering the advanced pie chart. It may throw an Exception if data retrieval fails. ```java protected BStats.JsonObjectBuilder.JsonObject getChartData() throws Exception ``` -------------------------------- ### NameValidator - geyserCheck Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/validation/NameValidator Validates Bedrock edition username with Geyser prefix. Strips prefix before checking format. ```APIDOC ## POST /api/namevalidator/geyserCheck ### Description Validates Bedrock edition username with Geyser prefix. Strips prefix before checking format. ### Method POST ### Endpoint /api/namevalidator/geyserCheck ### Parameters #### Query Parameters - **username** (string) - Required - Username to check. - **geyserPrefix** (string) - Required - Prefix used by Geyser (typically "."). ### Request Example ```json { "username": ".Player123", "geyserPrefix": "." } ``` ### Response #### Success Response (200) - **isValid** (boolean) - True if the username is a valid Geyser username, false otherwise. #### Response Example ```json { "isValid": true } ``` ``` -------------------------------- ### getChartData Method - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.DrilldownPie Retrieves the chart data for the DrilldownPie. This method is specified by the BStats.CustomChart class and may throw an Exception. ```java public BStats.JsonObjectBuilder.JsonObject getChartData() throws Exception ``` -------------------------------- ### BStats.AdvancedBarChart.getChartData Method Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.AdvancedBarChart Retrieves the chart data as a JsonObjectBuilder.JsonObject. ```APIDOC ## GET /chartData ### Description Retrieves the chart data as a JsonObjectBuilder.JsonObject. This method is inherited from BStats.CustomChart. ### Method GET ### Endpoint /chartData ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body needed for this GET method." } ``` ### Response #### Success Response (200) - **JsonObject** (BStats.JsonObjectBuilder.JsonObject) - The chart data. #### Response Example ```json { "example": "JsonObject representing chart data" } ``` ### Throws - **Exception** ``` -------------------------------- ### BStats.MultiLineChart getChartData Method Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.MultiLineChart Retrieves the chart data as a JsonObjectBuilder.JsonObject. This method is inherited from BStats.CustomChart. ```APIDOC ## getChartData Method ### Description Retrieves the chart data as a JsonObjectBuilder.JsonObject. This method is specified by `getChartData` in class `BStats.CustomChart`. ### Method GET ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example N/A ### Response #### Success Response (200) - **JsonObject** (BStats.JsonObjectBuilder.JsonObject) - The chart data. #### Response Example ```json { "example": "JsonObjectBuilder.JsonObject" } ``` ### Throws - **Exception** ``` -------------------------------- ### Validate Bedrock Edition Username with Geyser Prefix (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/validation/NameValidator Validates a Bedrock edition username by stripping a specified prefix before checking the format. This is useful for usernames that include a Geyser prefix, such as '.'. ```java public static boolean geyserCheck(String username, String geyserPrefix) Validates Bedrock edition username with Geyser prefix. Strips prefix before checking format. Parameters: `username` - username to check `geyserPrefix` - prefix used by Geyser (typically ".") Returns: true if valid Geyser username ``` -------------------------------- ### BStats.SingleLineChart getChartData Method Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.SingleLineChart Retrieves the chart data as a JsonObject. ```APIDOC ## GET /websites/javadoc_io_doc_in_arcadelabs_labaide_common-aide_1_3/BStats/SingleLineChart/getChartData ### Description Retrieves the chart data as a JsonObject. This method is inherited from the BStats.CustomChart class. ### Method GET ### Endpoint /websites/javadoc_io_doc_in_arcadelabs_labaide_common-aide_1_3/BStats/SingleLineChart/getChartData ### Parameters #### Query Parameters - **chartId** (String) - Required - The identifier of the chart to retrieve data for. ### Response #### Success Response (200) - **JsonObject** (BStats.JsonObjectBuilder.JsonObject) - The chart data in JSON object format. #### Response Example { "data": { "value": 100 } } ``` -------------------------------- ### BStats.CustomChart getChartData Method (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.CustomChart An abstract method that must be implemented by subclasses to provide the chart data. It returns a JsonObjectBuilder.JsonObject and can throw an Exception. ```java protected abstract BStats.JsonObjectBuilder.JsonObject getChartData() throws Exception ``` -------------------------------- ### ProbabilityCollection Iterator Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/randomizer/class-use/ProbabilityCollection.ProbabilitySetElement Retrieves an iterator over the probability elements within the ProbabilityCollection. ```APIDOC ## GET /common-aide/probability-collection/iterator ### Description Returns an iterator over probability elements within the ProbabilityCollection. ### Method GET ### Endpoint /common-aide/probability-collection/iterator ### Parameters #### Query Parameters - **ProbabilityCollection** (object) - Required - The ProbabilityCollection object to iterate over. ### Response #### Success Response (200) - **Iterator>** (object) - An iterator for probability set elements. #### Response Example { "example": "Iterator object representing probability elements" } ``` -------------------------------- ### Append JsonObject Field to Builder Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/class-use/BStats.JsonObjectBuilder.JsonObject Appends a JSON object as a field to the BStats.JsonObjectBuilder. This method takes a key (String) and a JsonObject as input. ```java BStats.JsonObjectBuilder.appendField(String key, BStats.JsonObjectBuilder.JsonObject object); ``` -------------------------------- ### getObject() Method - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/randomizer/ProbabilityCollection.ProbabilitySetElement Retrieves the element stored within the ProbabilitySetElement. This method is part of the ProbabilitySetElement class in the common-aide library. ```java public T getObject() { // Implementation to return the wrapped element. } ``` -------------------------------- ### getProbability() Method - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/randomizer/ProbabilityCollection.ProbabilitySetElement Retrieves the probability weight associated with the element in the ProbabilitySetElement. This method is part of the ProbabilitySetElement class in the common-aide library. ```java public int getProbability() { // Implementation to return the probability weight. } ``` -------------------------------- ### Change Player Experience - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Adds or removes experience points (XP) for a Minecraft player. This static method is part of the ExperienceManager utility. ```java ExperienceManager.changeExp(Player player, int amount) ``` -------------------------------- ### Add Element with Probability - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Adds an element to a ProbabilityCollection with a specified probability weight. This is used in scenarios where elements have varying chances of being selected. ```java add(E element, int weight) ``` -------------------------------- ### Append JsonObject Array Field to Builder Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/class-use/BStats.JsonObjectBuilder.JsonObject Appends an array of JSON objects as a field to the BStats.JsonObjectBuilder. This method takes a key (String) and an array of JsonObject instances. ```java BStats.JsonObjectBuilder.appendField(String key, BStats.JsonObjectBuilder.JsonObject[] values); ``` -------------------------------- ### NameValidator - offlineCheck Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/validation/NameValidator Validates a Minecraft username using offline format checking only. This method performs basic format validation without making any network requests. It checks that the username meets Minecraft's standard requirements for character set and length constraints. ```APIDOC ## POST /api/namevalidator/offlineCheck ### Description Validates a Minecraft username using offline format checking only. This method performs basic format validation without making any network requests. It checks that the username meets Minecraft's standard requirements for character set and length constraints. ### Method POST ### Endpoint /api/namevalidator/offlineCheck ### Parameters #### Query Parameters - **username** (string) - Required - The username to validate. ### Request Example ```json { "username": "Player123" } ``` ### Response #### Success Response (200) - **isValid** (boolean) - True if the username format is valid, false otherwise. #### Response Example ```json { "isValid": true } ``` #### Error Response (400) - **error** (string) - Description of the error (e.g., "Username is null") #### Error Example ```json { "error": "Username is null" } ``` ``` -------------------------------- ### Append Integer Field to JSON - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Appends an integer field to a JSON object using BStats.JsonObjectBuilder. This method is part of the metrics integration for Bukkit plugins. ```java appendField(String name, int value) ``` -------------------------------- ### Validate Minecraft Username Offline (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/validation/NameValidator Validates a Minecraft username using offline format checking only. This method performs basic format validation without network requests, checking character set and length constraints. It throws an IllegalArgumentException if the username is null. ```java public static boolean offlineCheck(String username) Validates a Minecraft username using offline format checking only. This method performs basic format validation without making any network requests. It checks that the username meets Minecraft's standard requirements for character set and length constraints. Examples: ``` // Valid username boolean isValid1 = NameValidator.offlineCheck("Player123"); // true // Invalid username (too short) boolean isValid2 = NameValidator.offlineCheck("AB"); // false // Invalid username (contains space) boolean isValid3 = NameValidator.offlineCheck("Player 123"); // false ``` Parameters: `username` - the username to validate Returns: `true` if the username format is valid, `false` otherwise Throws: `IllegalArgumentException` - if `username` is `null` See Also: * `onlineCheck(String)` * `geyserCheck(String, String)` ``` -------------------------------- ### Check Element Existence in Probability Collection - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Checks if an element exists within a ProbabilityCollection, ignoring the probability weights. This method determines presence rather than likelihood. ```java contains(E element) ``` -------------------------------- ### toString Method - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.JsonObjectBuilder.JsonObject The toString() method for the JsonObject class. This method overrides the default toString() implementation inherited from the Object class, likely providing a JSON string representation of the object. ```java public String toString() { // ... (implementation details omitted for brevity) } ``` -------------------------------- ### BStats.CustomChart getRequestJsonObject Method (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.CustomChart A concrete method that generates a JsonObjectBuilder.JsonObject representing the request. It accepts an error logger and a flag to control error logging. ```java public BStats.JsonObjectBuilder.JsonObject getRequestJsonObject(BiConsumer errorLogger, boolean logErrors) ``` -------------------------------- ### Removing Elements from ProbabilityCollection (Java) Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/randomizer/ProbabilityCollection Demonstrates removing all instances of a specific element from the ProbabilityCollection and recalculating indices. Returns true if the element was removed. ```Java ProbabilityCollection collection = new ProbabilityCollection<>(); collection.add("Apple", 5); collection.add("Apple", 2); boolean removed = collection.remove("Apple"); // true boolean hasAppleAfterRemove = collection.contains("Apple"); // false ``` -------------------------------- ### ProbabilitySetElement Class Definition - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/randomizer/ProbabilityCollection.ProbabilitySetElement Defines the ProbabilitySetElement class, an inner class of ProbabilityCollection. It stores an element of type T along with its probability weight and block index. This class is part of the common-aide library. ```java public static final class ProbabilityCollection.ProbabilitySetElement extends Object { // Methods to get the object and its probability weight are defined below. } ``` -------------------------------- ### Clear Probability Collection - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Removes all elements from a ProbabilityCollection. This resets the collection to an empty state. ```java clear() ``` -------------------------------- ### Append Object Array to JSON - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Appends an array of JSON objects to a parent JSON object using BStats.JsonObjectBuilder. This is useful for representing lists of complex data. ```java appendField(String name, BStats.JsonObjectBuilder.JsonObject[] value) ``` -------------------------------- ### Append Null Field to JSON - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Appends a null field to a JSON object using BStats.JsonObjectBuilder. This is useful for explicitly indicating the absence of a value. ```java appendNull(String name) ``` -------------------------------- ### Append String Field to JSON - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Appends a string field to a JSON object using BStats.JsonObjectBuilder. This is a common operation for adding string data to metrics. ```java appendField(String name, String value) ``` -------------------------------- ### Append Integer Array to JSON - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Appends an integer array field to a JSON object using BStats.JsonObjectBuilder. This is useful for sending metric data that includes arrays of integers. ```java appendField(String name, int[] value) ``` -------------------------------- ### Append String Array to JSON - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Appends a string array field to a JSON object using BStats.JsonObjectBuilder. This method is used for sending metric data containing arrays of strings. ```java appendField(String name, String[] value) ``` -------------------------------- ### JsonObject Class Definition - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/in/arcadelabs/labaide/common/metrics/BStats.JsonObjectBuilder.JsonObject Defines the JsonObject class, a static inner class of BStats.JsonObjectBuilder. It extends Object and provides a type-safe wrapper for JSON objects. It overrides the toString() method from the Object class. ```java public static class BStats.JsonObjectBuilder.JsonObject extends Object { // ... (implementation details omitted for brevity) } ``` -------------------------------- ### Append Object Field to JSON - Java Source: https://javadoc.io/doc/in.arcadelabs.labaide/common-aide/1.3/index-all Appends a JSON object field to another JSON object using BStats.JsonObjectBuilder. This allows for nested JSON structures. ```java appendField(String name, BStats.JsonObjectBuilder.JsonObject value) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.