API interface for interacting with EssentialsC's kit system. All methods are
synchronous and safe to call on the main thread. Kit data is loaded from
kits.yml at startup and kept in memory.
Retrieve an instance via EssentialsCAPI.getKitApi().
KitApi kits = APIProvider.getAPI().getKitApi();
Kit starter = kits.getKit("starter");
if (starter != null && kits.canClaim(player, starter)) {
kits.giveKit(player, starter);
}
The Kit data class lives in the
net.godlycow.org.essc.api.kit sub-package.
Method Summary
| Kit |
getKit(String name) Looks up a kit by its internal name. Returns null if not found. |
| Collection<Kit> |
getKits() Returns all currently loaded kits. |
| boolean |
hasPermission(Player player, Kit kit) Returns whether the player has permission to access the given kit. |
| boolean |
canClaim(Player player, Kit kit) Returns whether the player is currently eligible to claim the given kit. |
| boolean |
hasClaimed(Player player, Kit kit) Returns whether the player has claimed the given kit at least once. |
| int |
getClaimCount(Player player, Kit kit) Returns the number of times the player has claimed the given kit. |
| long |
getCooldownRemaining(Player player, Kit kit) Returns the seconds remaining on the player's cooldown for the given kit. |
| void |
giveKit(Player player, Kit kit) Gives the given kit to the player, bypassing all permission and cooldown checks. |
Looks up a kit by its internal name. Name matching is case-insensitive.
Parameters:| name | the name of the kit to look up; must not be null |
| Kit | the Kit, or null if no kit with that name exists |
Returns all currently loaded kits. The returned collection reflects the live kit map and will change if kits are reloaded. Do not assume a stable order.
Returns:| Collection<Kit> | all loaded kits; never null, may be empty |
Returns whether the given player has the permission to access the given kit. Returns true if the player holds the kit's specific permission node or the essentialsc.kits.admin bypass permission.
| player | the player to check; must not be null |
| kit | the kit to check against; must not be null |
| boolean | true if the player has permission to claim this kit |
Returns whether the given player is currently eligible to claim the given kit. This checks, in order:
- Whether the player has the required permission (see
hasPermission). - Whether the kit is one-time and has already been claimed.
- Whether the kit's max-claims limit has been reached.
- Whether the player is still on cooldown (bypassed by
essentialsc.kits.admin).
| player | the player to check; must not be null |
| kit | the kit to check; must not be null |
| boolean | true if the player may claim the kit right now |
Returns whether the given player has claimed the given kit at least once.
Parameters:| player | the player to check; must not be null |
| kit | the kit to check; must not be null |
| boolean | true if the player has at least one claim recorded |
Returns the number of times the given player has claimed the given kit.
Parameters:| player | the player to check; must not be null |
| kit | the kit to check; must not be null |
| int | the claim count; 0 if the player has never claimed this kit |
Returns the number of seconds remaining on the given player's cooldown for the given kit.
Parameters:| player | the player to check; must not be null |
| kit | the kit to check; must not be null |
| long | seconds until the player may claim again; 0 if not on cooldown |
Gives the given kit to the given player, bypassing all permission and cooldown checks.
Items that do not fit in the player's inventory are dropped naturally at their location. The claim is recorded in the database and the in-memory cache is updated. A success message is sent to the player and a DiscordSRV embed is dispatched if the integration is active.
This method must be called on the main thread.
Parameters:| player | the player to give the kit to; must not be null and must be online |
| kit | the kit to give; must not be null |