A Java API wrapper for the Pelican/Pterodactyl panel API. https://rainnny.club
Go to file
2024-10-21 14:02:19 +00:00
.gitea/workflows pass secret to env var 2024-04-28 19:19:10 -04:00
.github Update FUNDING.yml 2024-04-28 20:15:25 -04:00
src Complete the Node model 2024-04-28 21:07:35 -04:00
stylesheet Project setup 2024-04-27 21:20:48 -04:00
.gitignore Project setup 2024-04-27 21:20:48 -04:00
checkstyle.xml Project setup 2024-04-27 21:20:48 -04:00
CONTRIBUTING.md Update README.md 2024-04-28 20:28:36 -04:00
LICENSE Project setup 2024-04-27 21:20:48 -04:00
pom.xml chore(deps): update dependency org.junit.jupiter:junit-jupiter-engine to v5.11.3 2024-10-21 14:02:19 +00:00
README.md Update README.md 2024-04-29 02:39:56 -04:00
renovate.json chore(deps): add renovate.json 2024-04-28 02:03:03 +00:00

Pelican

MIT License Maven Publish Workflow Wakatime Hours Discord

Important

This API is currently a WIP and is not yet complete.

🦅 Pelican4J

A Java API wrapper for the Pelican and Pterodactyl panel API.


Table of Contents


🔬 Installation

Before getting started, you must add the dependency to your project. Below you can find the dependency for both Maven and Gradle.

Maven

<dependency>
  <groupId>me.braydon</groupId>
  <artifactId>Pelican4J</artifactId>
  <version>VERSION</version>
</dependency>

Gradle (Kotlin DSL)

implementation("me.braydon:Pelican4J:VERSION")

🏃‍♂️ Getting Started

Below is an example on how to create a client for Pelican (Ptero is also supported), and send an action to the panel.

Pelican4J<PelicanPanelActions> client = Pelican4J.forPelican(ClientConfig.builder()
        .panelUrl("https://pelican.app")
        .apiKey("YOUR_API_KEY")
        .build()); // Create a new Pelican client

// Queuing an action - this will get the node with the ID of 1, and print it's name.
ApplicationNodeActions nodeActions = client.actions().application().nodes();
nodeActions.getDetails(1).queue(node -> {
    System.out.println("Name of node: " + node.getName());
});

// Instantly sending an action
Node node = nodeActions.getDetails(1).execute();
System.out.println("Name of node: " + node.getName());

🔨 Panel Actions

Every action that is executed on the panel will return a PanelAction, this action has several different functions:

  • queue(callback) - This will allow you to queue an action, and await its response asynchronously.
  • execute() - This will immediately execute the action synchronously, and return the result.

Rate Limiting

When an action is being queued, it will try to immediately execute the action, and if a rate limit is hit, that action will be queued to be re-tried later once the rate limit has been lifted. If the action is re-tried more than 25 Times, it will respond with an error.

⚠️ Error Handling

When an error is raised by the panel API, an PanelAPIException exception will be thrown.

When queuing an action, errors are automatically handled and are printed to the terminal. To handle the error yourself, you can modify the callback function to contain both the response, and the exception:

ApplicationNodeActions nodeActions = client.actions().application().nodes();
nodeActions.getDetails(1).queue((node, ex) -> {
    if (ex != null) {
        // Handle the error...
        return;
    }
    // ...
});

YourKit

YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications. YourKit is the creator of YourKit Java Profiler, YourKit .NET Profiler, and YourKit YouMonitor.

Yourkit Logo