public interface Kit
Note that this kit requires explicit saving, see save()
| Modifier and Type | Method and Description |
|---|---|
default Kit |
addCommand(java.lang.String command)
Adds a command to the
Kit |
java.util.List<java.lang.String> |
getCommands()
Gets the commands associated with this kit.
|
java.util.Optional<java.time.Duration> |
getCooldown()
Gets the cooldown time for the kit.
|
double |
getCost()
The cost for claiming the kit.
|
default java.time.Duration |
getInterval()
Deprecated.
Use
getCooldown() |
default java.util.Collection<org.spongepowered.api.item.inventory.ItemStack> |
getItemsForPlayer(org.spongepowered.api.entity.living.player.Player player)
Obtains a collection of items that a player would obtain when redeeming the kit.
|
java.lang.String |
getName()
Gets the name of the kit.
|
java.util.List<org.spongepowered.api.item.inventory.ItemStackSnapshot> |
getStacks()
Gets the stacks that would be given out by this kit.
|
boolean |
ignoresPermission()
Gets whether redeeming this kit will ignore the permission checks.
|
boolean |
isAutoRedeem()
Gets whether the kit is automatically redeemed on login.
|
boolean |
isDisplayMessageOnRedeem()
Gets whether a message is displayed to the player when a kit is redeemed.
|
boolean |
isFirstJoinKit()
Returns whether this kit acts like a First Join Kit.
|
boolean |
isHiddenFromList()
Gets whether this kit is hidden from the
/kits list (except for those with permission to view it). |
boolean |
isOneTime()
Gets whether the kit is only allowed to be used one time, ever.
|
default KitRedeemResult |
redeem(org.spongepowered.api.entity.living.player.Player player)
Attempts to redeem this kit, saving it beforehand.
|
void |
redeemKitCommands(org.spongepowered.api.entity.living.player.Player player)
Redeems the commands in the kit, without redeeming the items.
|
default void |
save()
Saves this current kit's state.
|
Kit |
setAutoRedeem(boolean autoRedeem)
Sets whether the kit is automatically redeemed on login.
|
Kit |
setCommands(java.util.List<java.lang.String> commands)
Sets the commands associated with this kit.
|
Kit |
setCooldown(java.time.Duration cooldown)
Sets the cooldown time for the kit.
|
Kit |
setCost(double cost)
Set the cost for this kit.
|
Kit |
setDisplayMessageOnRedeem(boolean displayMessage)
Sets whether a message is displayed to the player when a kit is redeemed.
|
Kit |
setFirstJoinKit(boolean firstJoinKit)
Sets whether this kit will be redeemed on first join.
|
Kit |
setHiddenFromList(boolean hide)
Sets whether this kit is hidden from
/kits |
Kit |
setIgnoresPermission(boolean ignoresPermission)
Sets whether redeeming this kit ignores permission checks.
|
default Kit |
setInterval(java.time.Duration interval)
Deprecated.
Use
setCooldown(Duration) instead. |
Kit |
setOneTime(boolean oneTime)
Sets whether the kit is only allowed to be used one time, ever.
|
Kit |
setStacks(java.util.List<org.spongepowered.api.item.inventory.ItemStackSnapshot> stacks)
Set the stacks that would be given out by this kit.
|
Kit |
updateKitInventory(org.spongepowered.api.item.inventory.Inventory inventory)
Convenience method for updating the kit with the contents of the player's inventory.
|
Kit |
updateKitInventory(org.spongepowered.api.entity.living.player.Player player)
Convenience method for updating the kit with the contents of the player's inventory.
|
java.lang.String getName()
java.util.List<org.spongepowered.api.item.inventory.ItemStackSnapshot> getStacks()
List of ItemStackSnapshots.Kit setStacks(java.util.List<org.spongepowered.api.item.inventory.ItemStackSnapshot> stacks)
stacks - The List of ItemStackSnapshots.Kit, for chaining.@Deprecated default java.time.Duration getInterval()
getCooldown()Duration.ZERO
if there is no cooldown.Durationjava.util.Optional<java.time.Duration> getCooldown()
Duration@Deprecated default Kit setInterval(java.time.Duration interval)
setCooldown(Duration) instead.interval - The time the user has to wait before claiming the kit again.Kit, for chaining.Kit setCooldown(java.time.Duration cooldown)
cooldown - The time the user has to wait before claiming the kit again.Kit, for chaining.double getCost()
Kit setCost(double cost)
cost - The cost.Kit, for chaining.boolean isAutoRedeem()
true if soKit setAutoRedeem(boolean autoRedeem)
autoRedeem - Set true if the kit should automatically redeemed, false otherwise.Kit, for chaining.boolean isOneTime()
true if soKit setOneTime(boolean oneTime)
oneTime - Set true if the kit should only be used once, false otherwise.Kit, for chaining.java.util.List<java.lang.String> getCommands()
Kit setCommands(java.util.List<java.lang.String> commands)
commands - The list of commands, with {{player}} as the token for the name of the player.Kit for chaining.default Kit addCommand(java.lang.String command)
Kitcommand - The command to add.Kit for chaining.Kit updateKitInventory(org.spongepowered.api.item.inventory.Inventory inventory)
inventory - The inventory to get the kit from.Kit for chaining.Kit updateKitInventory(org.spongepowered.api.entity.living.player.Player player)
player - The player to get the kit from.Kit for chaining.default java.util.Collection<org.spongepowered.api.item.inventory.ItemStack> getItemsForPlayer(org.spongepowered.api.entity.living.player.Player player)
player - The playerNucleusKitService.getItemsForPlayer(Kit, Player)default KitRedeemResult redeem(org.spongepowered.api.entity.living.player.Player player)
player - The player to redeem the kit forvoid redeemKitCommands(org.spongepowered.api.entity.living.player.Player player)
player - The Player that should redeem the commands.boolean isDisplayMessageOnRedeem()
true if the player will be notified if a player will be notified.Kit setDisplayMessageOnRedeem(boolean displayMessage)
displayMessage - true to display a message to the player when they redeem a kit.Kit for chaining.boolean ignoresPermission()
Specifically, this is for when separate kit permissions are turned on in the Nucleus config, if this is
true, this kit will never require a separate permission to redeem.
true if this kit does not require a permission to redeem.Kit setIgnoresPermission(boolean ignoresPermission)
ignoresPermission - Whether to ignore separate permission checksKit, for chaining.boolean isHiddenFromList()
/kits list (except for those with permission to view it).
If hidden, a player won't be able to tab complete to this either, but can still redeem the kit.
/kits list and tab complete.Kit setHiddenFromList(boolean hide)
/kitshide - true if so.Kit, for chaining.boolean isFirstJoinKit()
true if so.Kit setFirstJoinKit(boolean firstJoinKit)
firstJoinKit - true if so.Kit, for chaining.default void save()
java.lang.IllegalStateException - if the kit module isn't active.