Interface Reward
-
- All Superinterfaces:
PluginSerializable
public interface Reward extends PluginSerializable
Represents a reward.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Reward
copy()
https://www.artima.com/intv/bloch13.htmlSet<RewardExecutorResult>
execute(org.bukkit.entity.Player player)
List<String>
getBroadcastMessage()
double
getChance()
Returns the chance.List<String>
getCommands()
Returns the list of commands.List<String>
getCommands(org.bukkit.entity.Player player)
Returns the list of commands formatted for the player.org.bukkit.inventory.ItemStack
getDisplayItem()
Returns the display item.List<org.bukkit.inventory.ItemStack>
getItems()
Returns the list of items.List<org.bukkit.inventory.ItemStack>
getItems(org.bukkit.entity.Player player)
Returns the list of formatted items.RewardLine
getLine()
Returns the reward line that is config-compatible.List<String>
getOpenMessage()
Crate
getParent()
Returns the crate that this reward belongs to.List<String>
getPermissions()
Deprecated.int
getSlot()
boolean
hasDisplayItem()
Checks whether this reward has an display item.boolean
hasItems()
Returns whether the list has a set of items.boolean
hasPermission(org.bukkit.entity.Player player)
Deprecated.boolean
hasPostParsing()
boolean
isConstant()
Returns whether this is a constant reward -- meaning that this reward will always be given to the player.boolean
isUnique()
Returns whether this is a unique reward.void
setBroadcastMessage(List<String> broadcastMessage)
void
setChance(double chance)
Sets the chance to a double representation.void
setCommands(List<String> commands)
Sets the list of commands.void
setConstant(boolean bool)
Set the constant property.void
setDisplayItem(org.bukkit.inventory.ItemStack item)
Sets the display item.void
setExecutor(BiFunction<Reward,org.bukkit.entity.Player,Set<RewardExecutorResult>> executor)
void
setItems(List<org.bukkit.inventory.ItemStack> items)
Sets the list of items.void
setOpenMessage(List<String> openMessage)
void
setParent(Crate crate)
void
setPermissions(List<String> perms)
Deprecated.void
setSlot(int slot)
void
setUnique(boolean bool)
Sets the unique property.-
Methods inherited from interface com.hazebyte.crate.api.crate.PluginSerializable
serialize
-
-
-
-
Method Detail
-
getParent
Crate getParent()
Returns the crate that this reward belongs to.- Returns:
- the parent of this reward. If the parent doesn't exist, this returns null.
-
setParent
void setParent(Crate crate)
-
getLine
RewardLine getLine()
Returns the reward line that is config-compatible.- Returns:
- the reward line
-
hasPermission
@Deprecated boolean hasPermission(org.bukkit.entity.Player player)
Deprecated.Checks if the player has any of the following permissions specified bygetPermissions()
- Parameters:
player
- the player to check- Returns:
- true if the player has any permission, false otherwise
-
setPermissions
@Deprecated void setPermissions(List<String> perms)
Deprecated.Sets the list of permissions.- Parameters:
perms
- the list of permissions to set
-
getPermissions
@Deprecated List<String> getPermissions()
Deprecated.Returns the set of permissions.- Returns:
- the list of permissions, otherwise the empty list
-
getSlot
int getSlot()
-
setSlot
void setSlot(int slot)
-
getChance
double getChance()
Returns the chance.- Returns:
- chance
-
setChance
void setChance(double chance)
Sets the chance to a double representation. The chance must be greater than or equal to zero.- Parameters:
chance
- the chance to set.
-
getDisplayItem
org.bukkit.inventory.ItemStack getDisplayItem()
Returns the display item.- Returns:
- the display item if non-null, otherwise null.
-
setDisplayItem
void setDisplayItem(org.bukkit.inventory.ItemStack item)
Sets the display item.- Parameters:
item
- the item to set.
-
hasDisplayItem
boolean hasDisplayItem()
Checks whether this reward has an display item.- Returns:
- true if the display item is non-null.
-
getItems
List<org.bukkit.inventory.ItemStack> getItems()
Returns the list of items.- Returns:
- the list of items, otherwise the empty list.
-
getItems
List<org.bukkit.inventory.ItemStack> getItems(org.bukkit.entity.Player player)
Returns the list of formatted items.- Parameters:
player
- the player to format the items to.- Returns:
- the list of formatted items, otherwise the empty list.
-
hasItems
boolean hasItems()
Returns whether the list has a set of items.- Returns:
- true if there are items, false otherwise.
-
setItems
void setItems(List<org.bukkit.inventory.ItemStack> items)
Sets the list of items.- Parameters:
items
- the list to set.
-
getCommands
List<String> getCommands()
Returns the list of commands.- Returns:
- the list of commands, otherwise the empty list.
-
getCommands
List<String> getCommands(org.bukkit.entity.Player player)
Returns the list of commands formatted for the player.- Parameters:
player
- The player to format the string for.- Returns:
- the list of formatted commands, otherwise the empty list.
-
setCommands
void setCommands(List<String> commands)
Sets the list of commands.- Parameters:
commands
- the list to set.
-
isConstant
boolean isConstant()
Returns whether this is a constant reward -- meaning that this reward will always be given to the player.- Returns:
- true if the reward is constant, false otherwise.
-
setConstant
void setConstant(boolean bool)
Set the constant property.- Parameters:
bool
- the variable constant
-
isUnique
boolean isUnique()
Returns whether this is a unique reward.- Returns:
- true if unique, otherwise false.
-
setUnique
void setUnique(boolean bool)
Sets the unique property.- Parameters:
bool
- the boolean to set.
-
execute
Set<RewardExecutorResult> execute(org.bukkit.entity.Player player)
-
setExecutor
void setExecutor(BiFunction<Reward,org.bukkit.entity.Player,Set<RewardExecutorResult>> executor)
-
hasPostParsing
boolean hasPostParsing()
-
copy
Reward copy()
https://www.artima.com/intv/bloch13.html- Returns:
- A copy of the reward.
-
-