Interface CrateManager


  • public interface CrateManager
    The manager for all crate related operations.
    • Method Detail

      • reload

        void reload()
        Reload everything related to crates.
      • getCrateIds

        List<String> getCrateIds()
        Get all registered crate IDs.
        Returns:
        an immutable List of crate identifiers
      • getCrateById

        Optional<Crate> getCrateById​(String id)
        Get a Crate by its identifier.
        Parameters:
        id - the identifier of the crate
        Returns:
        an Optional of Crate; empty if the crate does not exist
      • disableCrates

        void disableCrates​(String initiator)
        Prevent all crates from being opened.
        Parameters:
        initiator - the name of initiator of the action
      • enableCrates

        void enableCrates​(String initiator)
        Allow all crates to be opened.
        Parameters:
        initiator - the name of initiator of the action
      • showKeys

        void showKeys​(org.bukkit.command.CommandSender sender,
                      org.bukkit.OfflinePlayer target,
                      String crateId)
      • showKeys

        void showKeys​(org.bukkit.command.CommandSender sender,
                      org.bukkit.OfflinePlayer target)
      • keyAll

        void keyAll​(org.bukkit.command.CommandSender sender,
                    String crateId,
                    long amount,
                    String keyType)
      • addKeys

        void addKeys​(org.bukkit.command.CommandSender sender,
                     org.bukkit.OfflinePlayer target,
                     String crateId,
                     long amount,
                     String keyType)
      • removeKeys

        void removeKeys​(org.bukkit.command.CommandSender sender,
                        org.bukkit.OfflinePlayer target,
                        String crateId,
                        long amount)
      • setKeys

        void setKeys​(org.bukkit.command.CommandSender sender,
                     org.bukkit.OfflinePlayer target,
                     String crateId,
                     long amount)
      • isKey

        boolean isKey​(org.bukkit.inventory.ItemStack itemStack)
        Check if an ItemStack is a crate key
        Parameters:
        itemStack - the ItemStack to test
        Returns:
        true if a crate, otherwise false
      • getCrateByKey

        Optional<Crate> getCrateByKey​(org.bukkit.inventory.ItemStack itemStack)
        Get a Crate from any ItemStack
        Parameters:
        itemStack - the ItemStack to test
        Returns:
        an Optional of Crate; empty if the ItemStack is not a valid key
      • setCrateBlock

        void setCrateBlock​(org.bukkit.entity.Player sender,
                           org.bukkit.block.Block block,
                           String crateId)
      • removeCrateBlock

        void removeCrateBlock​(org.bukkit.entity.Player sender,
                              org.bukkit.block.Block block)
      • viewCratePreviewMenu

        void viewCratePreviewMenu​(org.bukkit.entity.Player player,
                                  Crate crate)
        Open the rewards preview menu for a Crate.
        Parameters:
        player - the Player to open the menu for
        crate - the Crate to preview rewards for
      • viewVirtualCratesMenu

        void viewVirtualCratesMenu​(org.bukkit.entity.Player player)
        Open the virtual crates menu.
        Parameters:
        player - the Player to open the menu for
      • openCratePhysically

        void openCratePhysically​(org.bukkit.entity.Player player,
                                 Crate crate,
                                 org.bukkit.block.Block block,
                                 org.bukkit.inventory.EquipmentSlot hand)
        Open a Crate with a physical key.

        Disclaimer: This method consumes the item in EquipmentSlot as a key with no checks.

        Parameters:
        player - the Player opening the crate
        crate - the Crate to open
        block - the Block of the crate
        hand - the EquipmentSlot the key is in
      • openCrateVirtually

        void openCrateVirtually​(org.bukkit.entity.Player player,
                                Crate crate,
                                int amount,
                                org.bukkit.block.Block block)
        Open a Crate with a virtual key.
        Parameters:
        player - the Player opening the crate
        crate - the Crate to open
        amount - the amount of keys to consume
        block - the Block of the crate, is null when opened via command or GUI
      • isOpeningCrate

        boolean isOpeningCrate​(org.bukkit.entity.Player player)
        Check if a player is currently opening a crate.
        Parameters:
        player - the Player to check
        Returns:
        true if the player is currently opening a crate, otherwise false