### Get Client Brand (Java) Source: https://docs.polar.top/api-clientversion-interface Retrieves the string brand of the Minecraft client, indicating the client type like "Vanilla" or "Forge". This helps in identifying modifications or specific client distributions. ```Java String brand(); ``` -------------------------------- ### Get Client Version Name (Java) Source: https://docs.polar.top/api-clientversion-interface Retrieves the string name of the Minecraft client version, such as "1.8.9". This is useful for displaying version information or performing version-specific logic. ```Java String name(); ``` -------------------------------- ### Get Client Protocol Version (Java) Source: https://docs.polar.top/api-clientversion-interface Retrieves the integer protocol version number used by the Minecraft client. This is essential for compatibility checks between client and server. ```Java int protocolVersion(); ``` -------------------------------- ### Get User from UserCancellableEvent (Java) Source: https://docs.polar.top/api-usercancellableevent-class Retrieves the User object associated with a UserCancellableEvent. This method is inherited from the CancellablePolarEvent class. ```java User user(); ``` -------------------------------- ### Get Action Command from CloudDetectionEvent Source: https://docs.polar.top/api-clouddetectionevent-class Retrieves the command that is executed when the cloud detection alert message is clicked. This command is typically used to perform an action related to the anticheat detection. ```Java String actionCommand(); ``` -------------------------------- ### Get CloudCheck from CloudDetectionEvent Source: https://docs.polar.top/api-clouddetectionevent-class Retrieves the CloudCheck object associated with a cloud detection event. This object contains information about the specific anticheat check that was triggered. ```Java CloudCheck check(); ``` -------------------------------- ### Get CloudCheckType from CloudDetectionEvent (Deprecated) Source: https://docs.polar.top/api-clouddetectionevent-class Retrieves the deprecated CloudCheckType associated with a cloud detection event. This method is replaced by CloudCheck and should not be used in new implementations. ```Java CloudCheckType cloudCheckType(); ``` -------------------------------- ### Get Chat Alert Message from CloudDetectionEvent Source: https://docs.polar.top/api-clouddetectionevent-class Retrieves the current chat alert message associated with a cloud detection event. This message is displayed to users when a detection is triggered. ```Java String chatAlertMessage(); ``` -------------------------------- ### Get Details from CloudDetectionEvent (Deprecated) Source: https://docs.polar.top/api-clouddetectionevent-class Retrieves deprecated details about a cloud detection event, such as cloud check tags. This method is replaced by CloudCheck and should be avoided in favor of the new CloudCheck object. ```Java String details(); ``` -------------------------------- ### Access Server Monitor Source: https://docs.polar.top/api-server-interface Provides access to the server's performance monitoring system. The returned Monitor instance allows for tracking various server statistics. ```java Monitor monitor(); ``` -------------------------------- ### Access Alert Settings Source: https://docs.polar.top/api-user-interface Methods to retrieve configuration settings for detection and mitigation alerts associated with the player. ```Java AlertSettings detectionAlertSettings(); AlertSettings mitigationAlertSettings(); ``` -------------------------------- ### Manage Player Connection and Bukkit Integration Source: https://docs.polar.top/api-user-interface Methods to access the underlying player connection and the associated Bukkit player instance if available. ```Java PlayerConnection connection(); Optional bukkitPlayer(); ``` -------------------------------- ### Register Event Listener Source: https://docs.polar.top/api-eventlistenerrepository-interface Methods to register event listeners with varying levels of configuration including priority and cancellation handling. ```APIDOC ## POST /registerListener ### Description Registers a listener for a specific event class. Overloads allow for defining priority and whether to ignore cancelled events. ### Method POST ### Parameters #### Request Body - **eventClass** (Class) - Required - The class of the event to listen for. - **consumer** (Consumer) - Required - The consumer that will handle the event. - **priority** (ListenerPriority) - Optional - The priority of the listener. - **ignoreCancelled** (boolean) - Optional - Whether to ignore cancelled events. ### Response #### Success Response (200) - **RegisteredListener** (Object) - A RegisteredListener instance representing the active listener. ### Response Example { "status": "success", "listenerId": "uuid-1234-5678" } ``` -------------------------------- ### Manage Action Command Source: https://docs.polar.top/api-usercancellablecheckevent-class Provides getter and setter methods for the command executed when a user clicks on the detection alert message in the chat. ```Java void actionCommand(String actionCommand); String actionCommand(); ``` -------------------------------- ### Retrieve Cloud Connection Details Source: https://docs.polar.top/api-cloudconnectionevent-class Methods to access the server instance, host address, and port associated with a cloud connection event. These methods return the configuration parameters used for the current Polar cloud connection. ```Java Server server(); String host(); int port(); ``` -------------------------------- ### Retrieve Player Latency Metrics Source: https://docs.polar.top/api-playerconnection-interface Methods to access network performance statistics for a player connection. These methods return latency values in milliseconds, providing insights into connection stability and speed. ```java long latency(); double latencyAverage(); double latencyDeviation(); ``` -------------------------------- ### Register Event Listener Methods Source: https://docs.polar.top/api-eventlistenerrepository-interface Provides overloaded methods to register event listeners for specific event classes. These methods allow for optional configuration of listener priority and event cancellation behavior, returning a RegisteredListener instance. ```java RegisteredListener registerListener(Class eventClass, Consumer consumer); ``` ```java RegisteredListener registerListener(Class eventClass, Consumer consumer, ListenerPriority priority); ``` ```java RegisteredListener registerListener(Class eventClass, Consumer consumer, ListenerPriority priority, boolean ignoreCancelled); ``` -------------------------------- ### Register Polar API Enable Callback with Hook Source: https://docs.polar.top/api-overview This Java code demonstrates a recommended pattern for registering the Polar API enable callback using a separate hook class. This promotes better code organization and adheres to class loading principles. ```java top.polar.api.loader.LoaderApi.registerEnableCallback(YourPolarApiHook::init); ``` -------------------------------- ### Register Polar API Enable Callback Source: https://docs.polar.top/api-overview This Java code snippet shows how to register a callback that will be executed once the Polar API is fully loaded. This is crucial for ensuring API availability before making calls or registering listeners. ```java @Override public void onEnable() { top.polar.api.loader.LoaderApi.registerEnableCallback(() -> { // Ideally, this logic is implemented in an external class. // API access here // Listener registration here // ... etc }); } ``` -------------------------------- ### Access Polar API instance Source: https://docs.polar.top/api-polarapiaccessor-class The access method retrieves a singleton-style instance of the PolarApi interface. It returns an Optional containing the API instance if available, or throws a PolarNotLoadedException if the environment is not properly initialized. ```java public static Optional access() throws PolarNotLoadedException; ``` -------------------------------- ### ClientVersion Interface Methods Source: https://docs.polar.top/api-clientversion-interface Methods available under the ClientVersion interface to retrieve client-specific information. ```APIDOC ## GET /client/protocolVersion ### Description Retrieves the protocol version number used by the client. ### Method GET ### Endpoint /client/protocolVersion ### Response #### Success Response (200) - **protocolVersion** (int) - The protocol version number. --- ## GET /client/name ### Description Retrieves the version name of the client (e.g., "1.8.9"). ### Method GET ### Endpoint /client/name ### Response #### Success Response (200) - **name** (String) - The client version name. --- ## GET /client/brand ### Description Retrieves the brand of the client (e.g., "Vanilla", "Forge"). ### Method GET ### Endpoint /client/brand ### Response #### Success Response (200) - **brand** (String) - The client brand name. ``` -------------------------------- ### Add Polar API as Gradle Dependency Source: https://docs.polar.top/api-overview This snippet shows how to add the Polar API as a project dependency using Gradle. It specifies the repository URL and the artifact coordinates. ```gradle repositories { maven { url = uri("https://repo.polar.top/repository/polar/") } } dependencies { compileOnly("top.polar:api:2.3.0") } ``` -------------------------------- ### Perform Administrative and Anticheat Actions Source: https://docs.polar.top/api-user-interface Methods to manage player status, including exempting players from anticheat checks and issuing punitive actions like kicks or bans. ```Java void exempt(); boolean kick(String reason); boolean issueKickPunishment(String reason); boolean issueBanPunishment(String reason); ``` -------------------------------- ### Statistic Interface Methods Source: https://docs.polar.top/api-statistic-interface Provides access to various statistical metrics. ```APIDOC ## Statistic Interface ### Description The `Statistic` interface provides methods to access statistical information. ## runningAverage ### Description Gets the running average of the statistic. ### Method GET ### Endpoint /websites/polar_top_api/statistic/runningAverage ### Response #### Success Response (200) - **average** (double) - The running average. #### Response Example ```json { "average": 123.45 } ``` ## runningMedian ### Description Gets the running median of the statistic. ### Method GET ### Endpoint /websites/polar_top_api/statistic/runningMedian ### Response #### Success Response (200) - **median** (double) - The running median. #### Response Example ```json { "median": 120.50 } ``` ## runningDeviation ### Description Gets the running standard deviation of the statistic. ### Method GET ### Endpoint /websites/polar_top_api/statistic/runningDeviation ### Response #### Success Response (200) - **deviation** (double) - The running standard deviation. #### Response Example ```json { "deviation": 15.75 } ``` ## sampleCount ### Description Gets the number of samples collected for the statistic. ### Method GET ### Endpoint /websites/polar_top_api/statistic/sampleCount ### Response #### Success Response (200) - **count** (long) - The sample count. #### Response Example ```json { "count": 1000 } ``` ``` -------------------------------- ### Retrieve UserRepository via PolarApi Source: https://docs.polar.top/api-polarapi-interface This method returns the UserRepository object, which is used to perform queries and manage user information. It returns an instance of the UserRepository class. ```java UserRepository userRepository(); ``` -------------------------------- ### Access Polar API Object Source: https://docs.polar.top/api-overview This Java code illustrates the basic usage of the Polar API by accessing the `PolarApi` object via `PolarApiAccessor`. It includes error handling for cases where the API is not loaded. ```java try { var weakApi = top.polar.api.PolarApiAccessor.access(); } catch (PolarNotLoadedException __) { log.error("API access violation - Polar Anticheat is not loaded"); } ``` -------------------------------- ### Retrieve Punishment Configuration Source: https://docs.polar.top/api-check-interface Methods to determine how a check handles violations. This includes checking if the check is punishable, the type of punishment applied, and the violation level threshold required to trigger it. ```java boolean punishable(); PunishmentType punishmentType(); double punishVl(); ``` -------------------------------- ### Add Polar API as Maven Dependency Source: https://docs.polar.top/api-overview This snippet demonstrates how to include the Polar API in your Maven project. It configures the repository and declares the dependency with a 'provided' scope. ```xml Polar https://repo.polar.top/repository/polar/ top.polar api 2.3.0 provided ``` -------------------------------- ### Query User by Name (Java) Source: https://docs.polar.top/api-userrepository-interface Fetches a user record using their username. This method is designed to return an Optional, which will hold the user object if the username exists, or be empty if no user is found with that name. It's part of the UserRepository interface. ```java Optional queryUserByName(String name); ``` -------------------------------- ### Registering an Event Listener with Polar API Source: https://docs.polar.top/api-overview Demonstrates how to register a custom event listener using the EventListenerRepository provided by the Polar API. This is the primary method for subscribing to custom events within the Polar ecosystem. Ensure you have a valid PolarApi reference. ```java var listener = api.events().repository().registerListener(...); ``` -------------------------------- ### Retrieve Kick Reason Source: https://docs.polar.top/api-ordinarykickevent-class.html Retrieves the specific reason provided for a player kick event. Returns a String representing the reason for the action. ```Java String reason(); ``` -------------------------------- ### Retrieve Player Identity and Client Information Source: https://docs.polar.top/api-user-interface Methods to access core player identity, including username, UUID, entity ID, and client-specific details like version and Bedrock status. ```Java String username(); String profile(); int entityId(); int ticksExisted(); boolean bedrock(); UUID uuid(); ClientVersion clientVersion(); ``` -------------------------------- ### Retrieve Performance Statistics via Monitor Interface Source: https://docs.polar.top/api-monitor-interface Methods for accessing various server performance metrics. Each method returns a Statistic object containing specific timing or data size information. ```java Statistic entityTrackingTimings(); Statistic playerTimeTimings(); Statistic scenarioCollectionTimings(); Statistic physicsSimulatorTimings(); Statistic blockCollisionTimings(); Statistic physicsResultFilterTimings(); Statistic transactionTaskTimings(); Statistic blockDigRaytraceTimings(); Statistic blockPlaceRaytraceTimings(); Statistic entityRaytraceTimings(); Statistic cloudPacketsTimings(); Statistic cloudProtocolOutTimings(); Statistic cloudCompressionTimings(); Statistic cloudDecompressionTimings(); Statistic cloudProtocolInTimings(); Statistic uncompressedBulkSizeStatistics(); Statistic compressionRateStatistics(); ``` -------------------------------- ### Reload Server Configuration Source: https://docs.polar.top/api-server-interface Triggers a reload of the Polar configuration files, equivalent to executing the /polar reload command. This method does not return a value. ```java void reloadConfig(); ``` -------------------------------- ### Manage Debug Details Source: https://docs.polar.top/api-usercancellablecheckevent-class Provides getter and setter methods to update or retrieve debug information related to the detection, such as movement or reach data. ```Java void details(String details); String details(); ``` -------------------------------- ### Check API Initiation Source: https://docs.polar.top/api-ordinarykickevent-class.html Determines whether the kick event was triggered programmatically via the API. Returns a boolean value indicating the source of the kick. ```Java boolean apiInitiated(); ``` -------------------------------- ### Retrieve Server Object via PolarApi Source: https://docs.polar.top/api-polarapi-interface This method retrieves the Server object, allowing access to server-specific functionalities. It returns an instance of the Server class. ```java Server server(); ``` -------------------------------- ### Query User by Entity ID (Java) Source: https://docs.polar.top/api-userrepository-interface Retrieves a user based on their integer entity ID. The method returns an Optional, providing the user object if a match is found, or an empty Optional otherwise. This is a key function within the UserRepository. ```java Optional queryUserByEntityId(int entityId); ``` -------------------------------- ### Retrieve Check Metadata and Status Source: https://docs.polar.top/api-check-interface Methods to access the core identity and configuration of an anticheat check. These methods return the check type, name, and current enabled status. ```java CheckType type(); String name(); boolean enabled(); ``` -------------------------------- ### Retrieve Statistical Metrics via Statistic Interface Source: https://docs.polar.top/api-statistic-interface This interface defines methods to access calculated statistical values. It provides access to running averages, medians, standard deviations, and the total count of samples collected. ```java double runningAverage(); double runningMedian(); double runningDeviation(); long sampleCount(); ``` -------------------------------- ### Check Cloud Connectivity Source: https://docs.polar.top/api-server-interface Verifies if the current server instance is successfully connected to the Polar cloud. Returns a boolean value indicating the connection state. ```java boolean cloudConnected(); ``` -------------------------------- ### Set Action Command for CloudDetectionEvent Source: https://docs.polar.top/api-clouddetectionevent-class Sets the command that will be executed when the chat alert message for a cloud detection event is clicked. This enables interactive alerts that can trigger specific actions. ```Java void actionCommand(String actionCommand); ``` -------------------------------- ### Update Alert Status Source: https://docs.polar.top/api-alertsettings-interface Updates the user's alert preference by setting the enabled state. Accepts a boolean parameter to toggle alerts on or off. ```java void setEnabled(boolean enabled); ``` -------------------------------- ### Retrieve CloudCheck Tags Source: https://docs.polar.top/api-cloudcheck-interface The tags method returns a set of strings representing tags associated with the detection. This method may return an empty set if no tags are present. ```java Set tags(); ``` -------------------------------- ### Check Alert Status Source: https://docs.polar.top/api-alertsettings-interface Determines if alerts are currently enabled for the user. Returns a boolean value indicating the current state. ```java boolean enabled(); ``` -------------------------------- ### Retrieve Event Listener Repository Source: https://docs.polar.top/api-events-interface Retrieves the EventListenerRepository instance used for managing event subscriptions. This method is essential for registering or unregistering listeners within the application. ```java EventListenerRepository repository(); ``` -------------------------------- ### Query User by UUID (Java) Source: https://docs.polar.top/api-userrepository-interface Queries for a user by their unique identifier (UUID). Returns an Optional which will contain the user if found, or be empty if no user matches the provided UUID. This method is part of the UserRepository interface. ```java Optional queryUserByUuid(UUID uuid); ``` -------------------------------- ### Access Events Manager via PolarApi Source: https://docs.polar.top/api-polarapi-interface This method provides access to the Events class, facilitating the management and handling of system events. It returns an instance of the Events class. ```java Events events(); ``` -------------------------------- ### Manage Event Cancellation State Source: https://docs.polar.top/api-cancellablepolarevent Methods to set or retrieve the cancellation status of an event. The setter accepts a boolean to toggle the state, while the getter returns the current status. ```java void cancelled(boolean cancelled); boolean cancelled(); ``` -------------------------------- ### Manage Chat Alert Message Source: https://docs.polar.top/api-usercancellablecheckevent-class Provides getter and setter methods to manipulate the chat alert message displayed during a check event. ```Java void chatAlertMessage(String chatAlertMessage); String chatAlertMessage(); ``` -------------------------------- ### CloudDetectionEvent API Source: https://docs.polar.top/api-clouddetectionevent-class Methods for managing cloud detection events, including retrieving check details and configuring alert behaviors. ```APIDOC ## GET /cloud-detection/check ### Description Retrieves the CloudCheck object that triggered the detection event. ### Method GET ### Endpoint /cloud-detection/check ### Response #### Success Response (200) - **check** (CloudCheck) - The CloudCheck instance that triggered the detection. --- ## GET /cloud-detection/chat-alert ### Description Retrieves the current chat alert message for the detection. ### Method GET ### Endpoint /cloud-detection/chat-alert ### Response #### Success Response (200) - **message** (String) - The current chat alert message. --- ## PUT /cloud-detection/chat-alert ### Description Updates the chat alert message displayed when a detection occurs. ### Method PUT ### Endpoint /cloud-detection/chat-alert ### Request Body - **chatAlertMessage** (String) - Required - The new alert message text. --- ## GET /cloud-detection/action-command ### Description Retrieves the command executed when the cloud detection alert is clicked. ### Method GET ### Endpoint /cloud-detection/action-command ### Response #### Success Response (200) - **command** (String) - The command string executed on click. --- ## PUT /cloud-detection/action-command ### Description Sets the command to be executed when the user clicks the cloud detection alert message. ### Method PUT ### Endpoint /cloud-detection/action-command ### Request Body - **actionCommand** (String) - Required - The new command to execute. ``` -------------------------------- ### Retrieve CloudCheck Type Source: https://docs.polar.top/api-cloudcheck-interface The type method returns the specific CloudCheckType associated with the current check instance. It is used to categorize the nature of the cloud detection. ```java CloudCheckType type(); ``` -------------------------------- ### Check Verbose Status in MitigationEvent Source: https://docs.polar.top/api-mitigationevent-class.html Retrieves the verbosity status of a mitigation event. Returns a boolean indicating whether the event is marked as verbose. ```java boolean verbose(); ``` -------------------------------- ### Retrieve Violation Metrics Source: https://docs.polar.top/api-check-interface Method to retrieve the current accumulated violation level for a specific check instance. ```java double violationLevel(); ``` -------------------------------- ### Unregister Event Listener Method Source: https://docs.polar.top/api-eventlistenerrepository-interface Removes a previously registered listener from the system. This method takes the RegisteredListener instance returned during the registration process as an input. ```java void unregisterListener(RegisteredListener listener); ``` -------------------------------- ### Retrieve Server UUID Source: https://docs.polar.top/api-server-interface Retrieves the unique identifier assigned to the server instance. This method returns a UUID object representing the server's identity. ```java UUID uuid(); ``` -------------------------------- ### Unregister Event Listener Source: https://docs.polar.top/api-eventlistenerrepository-interface Method to remove a previously registered event listener. ```APIDOC ## POST /unregisterListener ### Description Removes an existing event listener from the repository. ### Method POST ### Parameters #### Request Body - **listener** (RegisteredListener) - Required - The listener instance to unregister. ### Response #### Success Response (200) - **void** - No content returned upon successful unregistration. ``` -------------------------------- ### Access Check Object Source: https://docs.polar.top/api-usercancellablecheckevent-class Retrieves the Check instance associated with the current event. This is a read-only getter method. ```Java Check check(); ``` -------------------------------- ### Dispatch Polar API Events Source: https://docs.polar.top/api-events-interface Triggers a specific event, causing all registered listeners associated with that event type to execute. It accepts a generic type parameter that must extend the PolarApiEvent base class. ```java void callEvent(T event); ``` -------------------------------- ### Unregistering an Event Listener from Polar API Source: https://docs.polar.top/api-overview Shows how to unregister a previously registered event listener from the Polar API's event system. This is essential for managing resources and preventing memory leaks by removing listeners when they are no longer needed. The listener object obtained during registration is used for unregistration. ```java api.events().repository().unregisterListener(listener); ``` -------------------------------- ### Set Chat Alert Message for CloudDetectionEvent Source: https://docs.polar.top/api-clouddetectionevent-class Changes the message displayed in the chat alert when a cloud detection event occurs. This allows for custom notifications to be sent to players or administrators. ```Java void chatAlertMessage(String chatAlertMessage); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.