Interface Crate

  • All Superinterfaces:
    org.bukkit.configuration.serialization.ConfigurationSerializable

    public interface Crate
    extends org.bukkit.configuration.serialization.ConfigurationSerializable
    Represents a crate
    • Method Detail

      • getCrateName

        String getCrateName()
        Returns the name of the crate.
        This is the first order key of the crate configuration.
        Returns:
        the name of the crate
      • getDisplayName

        String getDisplayName()
        Returns the display name specified by the user.
        Returns:
        the user set name
      • getDisplayItem

        org.bukkit.inventory.ItemStack getDisplayItem()
        Returns the display item that is specified to be used
        in virtual menus.
        Returns:
        the display item
      • hasDisplayName

        boolean hasDisplayName()
        Checks whether this crate has a display name.
        Returns:
        true if the display name is not null, false otherwise.
      • hasDisplayItem

        boolean hasDisplayItem()
        Checks whether this crate has a display item.
        Returns:
        true if the display item is not null, false otherwise.
      • getType

        CrateType getType()
        Returns the type that determines the minecraft action
        that activates the crate.
        Returns:
        CrateType
      • getItem

        org.bukkit.inventory.ItemStack getItem()
        Returns the item that is given in-game to the player.
        Returns:
        the physical item
      • getCost

        double getCost()
        Returns the cost of a crate. The amount is set to zero if the amount is less than zero.
        Returns:
        the cost
      • setCost

        void setCost​(double amount)
              throws IllegalArgumentException
        Sets the cost of the crate
        Parameters:
        amount - the cost of the crate.
        This value must be greater than or equal to zero.
        Throws:
        IllegalArgumentException - If the cost is negative.
      • getAnimationType

        AnimationType getAnimationType()
        Returns the animation that open when the crate activation is triggered.
        Returns:
        AnimationType
      • addReward

        void addReward​(Reward reward)
        Adds a reward to the prize list. Calls Reward.setParent(Crate), and sets the parent to this crate.
        Parameters:
        reward - The reward to add
      • removeReward

        boolean removeReward​(Reward reward)
        Removes a reward from the prize list.
        Parameters:
        reward - The reward to remove
        Returns:
        true if reward was removed, false otherwise.
      • setRewards

        void setRewards​(List<Reward> rewards)
        Sets the list of rewards to a new list
        Parameters:
        rewards - The list to set
      • getRewards

        List<Reward> getRewards()
        Returns the list of rewards. If there are no rewards, it returns the empty list.
        Returns:
        List of Reward
      • getConstantRewards

        List<Reward> getConstantRewards()
        Returns the list of rewards that will be given to the player no matter what. If there are no rewards, it returns the empty list.
        Returns:
        List of Reward
      • getMinimumRewards

        int getMinimumRewards()
        Returns the user-set attribute used to generate prizes. If the minimum is greater than the maximum, it'll return the maximum.
        Returns:
        minimum number of rewards.
      • getMaximumRewards

        int getMaximumRewards()
        Returns the user-set attribute used to generate prizes. If the maximum is less than the minimum, it'll return the minimum.
        Returns:
        maximum number of rewards.
      • getPreviewRows

        int getPreviewRows()
        Returns the number of rows in a preview menu.
        Returns:
        the number of rows.
      • getPreviewSlots

        int getPreviewSlots()
        Returns the number of slots in a preview menu.
        Returns:
        the number of slots.
      • setAnimationType

        void setAnimationType​(AnimationType type)
        Sets the animation to a AnimationType
        Parameters:
        type - the type of animation
      • setDisplayItem

        void setDisplayItem​(org.bukkit.inventory.ItemStack item)
        Sets the display item which is displayed in virtual menus.
        Parameters:
        item - the ItemStack
      • setItem

        void setItem​(org.bukkit.inventory.ItemStack item)
        Sets the item which is given to a player.
        Parameters:
        item - the ItemStack
      • is

        boolean is​(org.bukkit.inventory.ItemStack item)
        Checks if an ItemStack equals this crate's item.
        The matching scheme is based on a configuration setting in the config.yml.
        The strictest setting will match with NBT. The lightest setting will compare the item's meta.
        Parameters:
        item - the ItemStack to compare
        Returns:
        true if the item matches, false otherwise.
      • isBuyable

        boolean isBuyable()
        Returns whether this crate is for sale.
        Returns:
        true if the crate is for sale, false otherwise.
      • isPreviewable

        boolean isPreviewable()
        Returns whether this crate is previewable.
        Returns:
        true if the crate is previewable, false otherwise.
      • hasConfirmationToggle

        boolean hasConfirmationToggle()
        Returns whether the crate has an confirmation toggle.
        Returns:
        true if there is an confirmation toggle, false otherwise.
      • setConfirmationToggle

        void setConfirmationToggle​(boolean bool)
        Sets the toggle that enables or disables the confirmation menu.
        Parameters:
        bool - the toggle.
      • setAcceptButton

        void setAcceptButton​(org.bukkit.inventory.ItemStack acceptButton)
      • getAcceptButton

        org.bukkit.inventory.ItemStack getAcceptButton()
      • setDeclineButton

        void setDeclineButton​(org.bukkit.inventory.ItemStack declineButton)
      • getDeclineButton

        org.bukkit.inventory.ItemStack getDeclineButton()
      • getHolographicText

        List<String> getHolographicText()
        Returns the set of strings used in an holographic.
        Returns:
        a list of strings, otherwise the empty list.
      • setHolographicText

        void setHolographicText​(List<String> texts)
        Sets the holographic text. This may be set to null to represent an empty holographic display.
        Parameters:
        texts - a list of strings. This may be set to null.
      • runEffect

        void runEffect​(org.bukkit.Location location,
                       Category category)
      • runEffect

        void runEffect​(org.bukkit.Location location,
                       Category category,
                       org.bukkit.entity.Player player)
        Starts all effects with the given Category at the given location. If the effect category is PERSISTENT, the effect will not run if there is a previous set of effects already running at that location. If a player is specified, the effect will only be shown for the target player.
        Parameters:
        location - the location at which the effects start.
        category - the category that triggers the effect.
        player - the player to show the effects to.
      • onReward

        void onReward​(org.bukkit.entity.Player player,
                      Reward reward)
        Called whenever a player triggers a win for this crate.
        Parameters:
        player - the player who activated the crate
        reward - the reward that was generated
      • onRewards

        void onRewards​(org.bukkit.entity.Player player,
                       List<Reward> rewards)
        Called whenever a player triggers a win for this crate.
        Parameters:
        player - the player who activated the crate.
        rewards - the set of rewards that was generated.
      • onRewards

        void onRewards​(org.bukkit.entity.Player player,
                       List<Reward> rewards,
                       org.bukkit.Location location)
      • onRewards

        void onRewards​(org.bukkit.entity.Player player,
                       List<Reward> rewards,
                       org.bukkit.Location location,
                       Consumer consumer)
      • getOpenMessage

        Message getOpenMessage()
        Returns the message wrapper. This message wrapper holds the set of messages individually sent to the player.
        Returns:
        Message
      • getBroadcast

        Message getBroadcast()
        Returns the message wrapper. This message wrapper holds the set of messages sent to every player.
        Returns:
        Message
      • isPlaceable

        boolean isPlaceable()
        Returns whether the crate is a placeable item.
        Returns:
        true if the item is placeable, false otherwise.