Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.Axeldu18:Pterodactyl-JAVA-API:1.3-SNAPSHOT'
}
dependencies {
implementation("com.github.Axeldu18:Pterodactyl-JAVA-API:1.3-SNAPSHOT")
}
<dependency>
<groupId>com.github.Axeldu18</groupId>
<artifactId>Pterodactyl-JAVA-API</artifactId>
<version>1.3-SNAPSHOT</version>
</dependency>
libraryDependencies += "com.github.Axeldu18" % "Pterodactyl-JAVA-API" % "1.3-SNAPSHOT"
:dependencies [[com.github.Axeldu18/Pterodactyl-JAVA-API "1.3-SNAPSHOT"]]
A java adaptation for the use of the Pterodactyl panel API
For use you need to call the class PterodactylAPI like this:
PterodactylAPI api = new PterodactylAPI();
api.setMainURL("URL OF YOUR PANEL");
api.setPublicKey("PUBLIC API KEY");
api.setSecretKey("SECRET API KEY");
api.setSecureConection(true|false); //Set secure conection (default false)
Then to retrieve the list of servers on the system you need to call the function getServer() in Servers classes
HashMap<Integer, Server> servers = this.getServers().getServers();
Now there is 5 Classes to get informations from the API
For create a new user you need to call the function like this:
User user = this.getUsers().createUser(email, username, first_name, last_name, password, root_admin);
System.out.println(user.toString());
It return the User class with all the attributes of the new user