Package com.hazebyte.crate.api.crate
Interface CrateRegistrar
-
public interface CrateRegistrar
Contains methods used to manipulate and retrieve a crate.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(Crate crate)
Adds a crate to the plugin.Crate
createCrate(String name, CrateType type)
Returns a crate with the given name, and type.Reward
createReward()
Creates a default reward.Reward
createReward(String line)
Creates a reward using a reward line.List<Reward>
generateCrateRewards(Crate crate, org.bukkit.entity.Player player)
Uses the built-in reward generator to pick a prize for a player.Crate
getCrate(String str)
Retrieves the specifiedCrate
given the crate identifier name.Crate
getCrate(org.bukkit.inventory.ItemStack item)
Retrieves the specifiedCrate
with a item.List<Crate>
getCrateFromDisplayName(String str)
Retrieves the specifiedCrate
given the display name.List<Crate>
getCrates()
Returns a list of cratesString
getCrateString()
void
giveCrate(Crate crate, org.bukkit.entity.Player player, int amount)
Gives the specified player the specified amount of crates.boolean
isCrate(org.bukkit.inventory.ItemStack item)
Checks if the item represents a crate.void
open(Crate crate, org.bukkit.entity.Player player, org.bukkit.Location location)
void
open(Crate crate, org.bukkit.entity.Player player, org.bukkit.Location location, Map<String,Object> settings)
void
openConfirmationPage(Crate crate, org.bukkit.entity.Player player, org.bukkit.Location location)
void
preview(Crate crate, org.bukkit.entity.Player player)
Previews a crate in a built-in menu.void
previewAll(List<Crate> crates, org.bukkit.entity.Player player)
Previews all crates in a built-in menu.boolean
purchase(Crate crate, org.bukkit.entity.Player player, int amount)
Sends a playeramount
of this crate and withdraws the cost of the crate.void
remove(Crate crate)
Removes a crate from the plugin.
-
-
-
Method Detail
-
createCrate
Crate createCrate(String name, CrateType type) throws IllegalArgumentException
Returns a crate with the given name, and type.- Parameters:
name
- The ID or name of the cratetype
-CrateType
- Returns:
Crate
- Throws:
IllegalArgumentException
- when the name or type is null
-
createReward
Reward createReward(String line)
Creates a reward using a reward line.- Parameters:
line
- reward line- Returns:
Reward
-
getCrate
Crate getCrate(org.bukkit.inventory.ItemStack item)
Retrieves the specifiedCrate
with a item.- Parameters:
item
- ItemStack- Returns:
Crate
-
getCrate
Crate getCrate(String str)
Retrieves the specifiedCrate
given the crate identifier name.- Parameters:
str
- Crate Identifier- Returns:
Crate
-
getCrateFromDisplayName
List<Crate> getCrateFromDisplayName(String str)
Retrieves the specifiedCrate
given the display name.- Parameters:
str
- Display Name- Returns:
Crate
-
isCrate
boolean isCrate(org.bukkit.inventory.ItemStack item)
Checks if the item represents a crate.- Parameters:
item
-ItemStack
- Returns:
- true if the item is a crate, false otherwise.
-
add
void add(Crate crate)
Adds a crate to the plugin. This registers the crate and makes it available to use.- Parameters:
crate
- The crate that you want to add
-
remove
void remove(Crate crate)
Removes a crate from the plugin. This unregisters the crate from the plugin. Actions will no longer be handled by this crate if you do so.- Parameters:
crate
- The crate that you will remove
-
generateCrateRewards
List<Reward> generateCrateRewards(Crate crate, org.bukkit.entity.Player player)
Uses the built-in reward generator to pick a prize for a player. The reward has to pass the permission check before it is put into the list.- Parameters:
player
- The player who should win this reward set.- Returns:
- List of
Reward
specifically for aPlayer
-
open
void open(Crate crate, org.bukkit.entity.Player player, org.bukkit.Location location)
-
open
void open(Crate crate, org.bukkit.entity.Player player, org.bukkit.Location location, Map<String,Object> settings)
-
openConfirmationPage
void openConfirmationPage(Crate crate, org.bukkit.entity.Player player, org.bukkit.Location location)
-
preview
void preview(Crate crate, org.bukkit.entity.Player player)
Previews a crate in a built-in menu.- Parameters:
crate
- The crate that will be previewedplayer
- The player who wants to see the crate
-
previewAll
void previewAll(List<Crate> crates, org.bukkit.entity.Player player)
Previews all crates in a built-in menu.- Parameters:
crates
- The list of crates to be viewedplayer
- The player who wants to see the crate
-
purchase
boolean purchase(Crate crate, org.bukkit.entity.Player player, int amount)
Sends a playeramount
of this crate and withdraws the cost of the crate.- Parameters:
player
- The player who wants to purchase the crate.amount
- The amount that the player wants to purchase.- Returns:
- true if the transaction is successful, otherwise false.
-
giveCrate
void giveCrate(Crate crate, org.bukkit.entity.Player player, int amount)
Gives the specified player the specified amount of crates.- Parameters:
player
- The player to give the crate to.amount
- The amount to give
-
getCrateString
String getCrateString()
-
-