public interface NucleusKitService
Modifier and Type | Method and Description |
---|---|
Kit |
createKit(java.lang.String name)
Gets a new kit object for use with the Kit service.
|
java.util.concurrent.CompletableFuture<java.util.Optional<java.time.Instant>> |
getCooldownExpiry(Kit kit,
org.spongepowered.api.entity.living.player.User player)
If a
Player is unable to redeem the given Kit as
they have previously redeemed it and that the cooldown has not
expired, will return the Instant the User may
redeem the kit again. |
java.util.Collection<org.spongepowered.api.item.inventory.ItemStack> |
getItemsForPlayer(Kit kit,
org.spongepowered.api.entity.living.player.Player player)
Returns the items for a kit that the target player would redeem
(that is, with token replacements if applicable).
|
java.util.Optional<Kit> |
getKit(java.lang.String name)
Gets the requested kit if it exists.
|
java.util.Set<java.lang.String> |
getKitNames()
Gets the names of all the kits currently in NucleusPlugin.
|
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
hasPreviouslyRedeemed(Kit kit,
org.spongepowered.api.entity.living.player.User player)
Returns whether the given
Kit has previously been
redeemed by the Player . |
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
isRedeemable(Kit kit,
org.spongepowered.api.entity.living.player.User player)
Gets whether a
Player can redeem the given Kit
given any cooldown and one-time kit status |
KitRedeemResult |
redeemKit(Kit kit,
org.spongepowered.api.entity.living.player.Player player,
boolean performChecks)
Redeems a kit on a player.
|
KitRedeemResult |
redeemKit(Kit kit,
org.spongepowered.api.entity.living.player.Player player,
boolean performChecks,
boolean mustRedeemAll)
Redeems a kit on a player.
|
boolean |
removeKit(java.lang.String kitName)
Removes the requested kit.
|
void |
renameKit(java.lang.String kitName,
java.lang.String newKitName)
Renames a kit.
|
void |
saveKit(Kit kit)
Saves a kit.
|
java.util.Set<java.lang.String> getKitNames()
Set
of String
s.java.util.Optional<Kit> getKit(java.lang.String name)
name
- The name of the kit.Optional
that might contain the kit.java.util.Collection<org.spongepowered.api.item.inventory.ItemStack> getItemsForPlayer(Kit kit, org.spongepowered.api.entity.living.player.Player player)
kit
- The kit to processplayer
- The playerjava.util.concurrent.CompletableFuture<java.lang.Boolean> hasPreviouslyRedeemed(Kit kit, org.spongepowered.api.entity.living.player.User player)
Kit
has previously been
redeemed by the Player
.
No assumptions about whether the kit may be redeemed again is made.
kit
- The Kit
player
- The User
java.util.concurrent.CompletableFuture<java.lang.Boolean> isRedeemable(Kit kit, org.spongepowered.api.entity.living.player.User player)
Player
can redeem the given Kit
given any cooldown and one-time kit statuskit
- The Kit
player
- The User
java.util.concurrent.CompletableFuture<java.util.Optional<java.time.Instant>> getCooldownExpiry(Kit kit, org.spongepowered.api.entity.living.player.User player)
Player
is unable to redeem the given Kit
as
they have previously redeemed it and that the cooldown has not
expired, will return the Instant
the User
may
redeem the kit again.kit
- The Kit
player
- The Player
Instant
the cooldown expires, if there is a
cooldown in effect.KitRedeemResult redeemKit(Kit kit, org.spongepowered.api.entity.living.player.Player player, boolean performChecks)
kit
- The kit to redeemplayer
- The player to redeem the kit againstperformChecks
- Whether to perform standard permission and cooldown checksKitRedeemResult
KitRedeemResult redeemKit(Kit kit, org.spongepowered.api.entity.living.player.Player player, boolean performChecks, boolean mustRedeemAll)
kit
- The kit to redeemplayer
- The player to redeem the kit againstperformChecks
- Whether to perform standard permission and cooldown checksmustRedeemAll
- Whether all items must be redeemed to count as a successKitRedeemResult
boolean removeKit(java.lang.String kitName)
kitName
- The name of the kit to remove.true
if a kit was removed.void renameKit(java.lang.String kitName, java.lang.String newKitName) throws java.lang.IllegalArgumentException
kitName
- The name of the kit to renamenewKitName
- The new name of the kitjava.lang.IllegalArgumentException
- if either the kit or the target name are unavailablevoid saveKit(Kit kit)
kit
- The kit.Kit createKit(java.lang.String name) throws java.lang.IllegalArgumentException
Do not make your own kit type, it will not get saved! Use this instead.
name
- The name of the kit to createKit
java.lang.IllegalArgumentException
- if the kit name already exists, or is invalid