API Documentation/Depending on PlayerHeads

You are able to use the PlayerHeads API or information in your own plugins by first including it as a dependency.  This page describes methods for accomplishing this task. 

To use the PlayerHeads API, you can either depend directly on one of the JARs or add a dependency to your maven project. 

Note: API versions are generally backwards-compatible (down to 4.10.0) unless indicated otherwise by deprecation.

Using a JAR dependency

In major version releases available from the Files tab, there are often attached API JARs which you can download. These contain classes and interfaces that PlayerHeads will make available at runtime.

The process of adding a dependency for your project depends on your IDE, but it will include selecting the API jar file for this purpose, after which the packages should be accessible in your code.





Using a Maven depdendency

Alternatively, the PlayerHeads API can be used as a dependency in your maven projects in a more uniform manner as follows:

Add the following repository to your project (in the < repositories> tag) in your pom.xml:

    </repository>(note: the above code may be mangled by the formatting here)

Add the following dependency to your project (in the < dependencies> tag)

    </dependency>And replace 4.10.0 with the API version you wish to use (eg: 5.1.0, 5.2.0, ...)

Note: If you build the PlayerHeads API locally, you may find that your maven build will prefer it over the standard repository version.


Other configuration requirements

First of all, a warning for developers: do not under any circumstances shade/copy the API classes into your plugin - this will cause conflicts with PlayerHeads and possibly other plugins when loading the server.

The other requirement of note is to modify the plugin.yml file of your plugin to include PlayerHeads as a depdency as one of the following:

  • depend: [PlayerHeads]
    (if your plugin requires PlayerHeads to be loaded in order to function)
  • softdepend: [PlayerHeads]
    (if your plugin can run without PlayerHeads being present)

If the properties above already exist, you can append the list similar to [SomePlugin,AnotherPlugin,PlayerHeads]

Getting the class documentation (javadoc)

Updated API class/method documentation can be found at the following link: https://crashdemons.github.io/PlayerHeads


Posts Quoted:
Clear All Quotes