# Overview

The **Java MCStatus** library is a Java-based wrapper for the [mcstatus.io API](https://mcstatus.io/). It is a fork of the original `node-mcstatus` npm package, ported to Java to provide similar functionality for Java developers. This library allows you to easily retrieve the status of Minecraft Java and Bedrock Edition servers, including details such as player count, server version, MOTD, and more.

***

### Key Features

* **Java and Bedrock Server Support**: Retrieve status information for both Minecraft Java and Bedrock Edition servers.
* **Simple and Intuitive API**: Designed to be easy to use, with methods for fetching server status, player lists, MOTD, and more.
* **Customizable Timeout**: Set a custom timeout for API requests to handle slow or unresponsive servers.
* **Error Handling**: Provides robust error handling for invalid server addresses or failed API requests.
* **Icon Retrieval**: Fetch server icons as `BufferedImage` objects or URLs.

***

### Table of Contents

1. [Installation](#installation)
2. [Usage](#usage)
   * [Java Status](#java-status)
   * [Bedrock Status](#bedrock-status)
   * [Server Icon](#server-icon)
3. [License](https://chat.deepseek.com/a/chat/s/bd874750-0c5f-4e5c-8dfc-cbd0bb0bef8d#license)

***

### Installation

To use the **Java MCStatus** library, include it as a dependency in your project. Download the library from Github repository, [here](https://github.com/UndeffinedDev/mcstatus-io/releases/tag/1.0)

***

### Usage

#### Java Status

Retrieve the status of a Minecraft Java Edition server.

```java
import io.github.undeffineddev.mcstatusio.java.JavaStatus;

public class Main {
    public static void main(String[] args) {
        try {
            JavaStatus status = new JavaStatus("demo.mcstatus.io", true, 5.0);

            System.out.println("Online: " + status.isOnline());
            System.out.println("Players Online: " + status.getPlayersOnline());
            System.out.println("Version: " + status.getVersionNameClean());
            System.out.println("MOTD: " + status.getMotdClean());
        } catch (RuntimeException e) {
            System.err.println("Error: " + e.getMessage());
        }
    }
}
```

[Java Complete Example](/mcstatusio/class-documentation-javastatus.md#usage-example)

#### Bedrock Status

Retrieve the status of a Minecraft Bedrock Edition server.

```java
import io.github.undeffineddev.mcstatusio.bedrock.BedrockStatus;

public class Main {
    public static void main(String[] args) {
        try {
            BedrockStatus status = new BedrockStatus("demo.mcstatus.io", 19132);

            System.out.println("Online: " + status.isOnline());
            System.out.println("Players Online: " + status.getPlayersOnline());
            System.out.println("Version: " + status.getVersionName());
            System.out.println("MOTD: " + status.getMotdClean());
        } catch (RuntimeException e) {
            System.err.println("Error: " + e.getMessage());
        }
    }
}
```

[Bedrock Complete Example](/mcstatusio/class-documentation-bedrockstatus.md#usage-example)

#### Server Icon

Retrieve the server icon as a `BufferedImage` or URL.

```java
import io.github.undeffineddev.mcstatusio.java.icon.Icon;
import java.awt.image.BufferedImage;

public class Main {
    public static void main(String[] args) {
        // Fetch the server icon as a BufferedImage
        BufferedImage icon = Icon.getServerIcon("demo.mcstatus.io");

        if (icon != null) {
            System.out.println("Server icon successfully retrieved!");
        } else {
            System.err.println("Failed to retrieve the server icon.");
        }

        // Fetch the server icon URL
        String iconUrl = Icon.getServerIconAsLink("demo.mcstatus.io");
        System.out.println("Server icon URL: " + iconUrl);
    }
}
```

[Icon Complete Example](/mcstatusio/class-documentation-icon.md#usage-example)

***

### License

This library is licensed under the **MIT License**. See the [LICENSE](https://github.com/undeffineddev/mcstatus-io/blob/main/LICENSE) file for more details.

***

### Why Use This Library?

* **Familiar API**: If you're coming from the Node.js or Python versions of `mcstatus`, you'll find the API very similar.
* **Lightweight**: Designed to be minimal and easy to integrate into your Java projects.
* **Cross-Platform**: Works on any platform that supports Java.

***

This **Java MCStatus** library is a powerful tool for developers who need to interact with Minecraft servers programmatically. Whether you're building a server monitoring tool, a server list, or just experimenting, this library has you covered! Let me know if you need further assistance.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://undeffineddev.gitbook.io/mcstatusio/overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
