public interface Kit
Note that this kit requires explicit saving, see save()
Modifier and Type | Method and Description |
---|---|
default Kit |
addCommand(String command)
Adds a command to the
Kit |
List<String> |
getCommands()
Gets the commands associated with this kit.
|
Optional<Duration> |
getCooldown()
Gets the cooldown time for the kit.
|
double |
getCost()
The cost for claiming the kit.
|
default Duration |
getInterval()
Deprecated.
Use
getCooldown() |
default 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.
|
String |
getName()
Gets the name of the kit.
|
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 NucleusKitService.RedeemResult |
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(List<String> commands)
Sets the commands associated with this kit.
|
Kit |
setCooldown(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(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(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.
|
String getName()
List<org.spongepowered.api.item.inventory.ItemStackSnapshot> getStacks()
List
of ItemStackSnapshot
s.Kit setStacks(List<org.spongepowered.api.item.inventory.ItemStackSnapshot> stacks)
@Deprecated default Duration getInterval()
getCooldown()
Duration.ZERO
if there is no cooldown.Duration
Optional<Duration> getCooldown()
Duration
@Deprecated default Kit setInterval(Duration interval)
setCooldown(Duration)
instead.interval
- The time the user has to wait before claiming the kit again.Kit
, for chaining.Kit setCooldown(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.List<String> getCommands()
Kit setCommands(List<String> commands)
commands
- The list of commands, with {{player}}
as the token for the name of the player.Kit
for chaining.default Kit addCommand(String command)
Kit
command
- 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 Collection<org.spongepowered.api.item.inventory.ItemStack> getItemsForPlayer(org.spongepowered.api.entity.living.player.Player player)
player
- The playerNucleusKitService.getItemsForPlayer(Kit, Player)
default NucleusKitService.RedeemResult redeem(org.spongepowered.api.entity.living.player.Player player) throws KitRedeemException
player
- The player to redeem the kit forKitRedeemException
- If the kit was not redeemed.void 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)
/kits
hide
- 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()
IllegalStateException
- if the kit module isn't active.