Full Working Example
The example below loads the first configured public kit for every player the moment they join the server. It covers event registration, API access, and safe list handling in one self-contained class.ExamplePlugin.java
Step-by-Step Explanation
Obtain the API singleton
Call
API.getInstance() to retrieve the shared API object. PerPlayerKit creates and holds this singleton during its own onEnable(), so as long as you have declared PerPlayerKit as a depend in your plugin.yml, the instance is always available by the time your code runs.Fetch the list of public kits
Call
api.getPublicKits() to get all public kits currently configured in PerPlayerKit. The method returns a copy of the internal list, so iterating or modifying the returned list will not affect PerPlayerKit’s own data.The PublicKit Object
PublicKit is a simple data class with three public fields:
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier for the kit, used internally by PerPlayerKit. |
name | String | Human-readable display name of the kit. |
icon | org.bukkit.Material | The material used to represent the kit in GUIs. |
loadPublicKit.
plugin.yml Setup
DeclarePerPlayerKit as a hard dependency so Paper guarantees it loads before your plugin:
plugin.yml
