Class HeadDatabaseAPI

java.lang.Object
me.arcaniax.hdb.api.HeadDatabaseAPI

public class HeadDatabaseAPI extends Object
  • Constructor Details

    • HeadDatabaseAPI

      public HeadDatabaseAPI()
  • Method Details

    • setPrefixID

      public void setPrefixID(String prefix)
      Sets the prefix ID to be used by the API for added heads
      Parameters:
      prefix - The prefix to use
    • isHead

      public boolean isHead(String ID)
      Checks whether a head exists with the given ID
      Parameters:
      ID - The ID to check
      Returns:
      true if a head exists with the given ID, otherwise false
    • isDecorativeHead

      public boolean isDecorativeHead(Block block)
      Checks if a Block is a decorative (non-player) head
      Parameters:
      block - The block to check
      Returns:
      true if the block is a decorative head, otherwise false
    • isDecorativeHead

      public boolean isDecorativeHead(ItemStack itemStack)
      Checks if an ItemStack is a decorative (non-player) head
      Parameters:
      itemStack - The item to check
      Returns:
      true if the item is a decorative head, otherwise false
    • getItemHead

      public ItemStack getItemHead(String id)
      Gets an ItemStack of a head with the given ID
      Parameters:
      id - The ID of the head to get
      Returns:
      An ItemStack of a head with the given ID, or null if one does not exist
    • getItemHead

      public ItemStack getItemHead(Block block)
      Gets an ItemStack of a head from a player skull Block
      Parameters:
      block - The ID of the head to get
      Returns:
      An ItemStack of a head from the given block, or null if the block is not a head
    • getItemID

      public String getItemID(ItemStack itemStack)
      Gets the head ID of an ItemStack
      Parameters:
      itemStack - The item to get the ID from
      Returns:
      The head ID of the item, or null if the item is not a head or is not in the database
    • getBlockID

      public String getBlockID(Block block)
      Gets the head ID of a Block
      Parameters:
      block - The block to get the ID from
      Returns:
      The head ID of the block, or null if the block is not a head or is not in the database
    • getBase64

      public String getBase64(String id)
      Gets the base64 string from a head ID
      Parameters:
      id - The ID of the head
      Returns:
      The base64 String from a head ID, or null if one does not exist
    • getBase64

      public String getBase64(ItemStack itemStack)
      Gets the base64 String from an ItemStack
      Parameters:
      itemStack - The ItemStack
      Returns:
      The base64 String from an ItemStack, or null if one does not exist
    • getBase64

      public String getBase64(Block block)
      Gets the base64 String from a Block
      Parameters:
      block - The Block to get the base64 string from
      Returns:
      The base64 String from the Block, or null if the block is not a head or does not have a base64 String
    • addHead

      public boolean addHead(CategoryEnum category, Head head)
      Adds a new Head to the database
      Parameters:
      category - The category to add the head to
      head - The head to add
      Returns:
      true if the head was successfully added, otherwise false
    • getHeads

      public List<Head> getHeads(CategoryEnum category)
      Gets a List of all Heads in a given category in the database
      Parameters:
      category - The category to check
      Returns:
      A list of heads in the given category, or an empty list if none
    • getRandomHead

      public ItemStack getRandomHead()
      Returns:
      a random head from the database as an ItemStack
    • getCategory

      public CategoryEnum getCategory(String id)
      Gets the Category that a head ID is part of
      Parameters:
      id - The ID of the head
      Returns:
      The category that the head ID belongs to, or null if not found
    • setBlockSkin

      public boolean setBlockSkin(Block block, String id)
      Sets the texture of a player head block to the given head ID
      Parameters:
      block - The block to set the texture of
      id - The ID of the head to set the texture to
      Returns:
      true if the block texture was successfully applied, otherwise false
    • addHead

      public String addHead(CategoryEnum category, String name, UUID uuid)
      Adds a head to the database
      Parameters:
      category - The category to add to
      name - The name of the head
      uuid - The UUID owner of the head
      Returns:
      The ID of the head that was added, or null if unable to add
    • addHead

      public String addHead(CategoryEnum category, String name, String base64)
      Adds a head to the database
      Parameters:
      category - The category to add to
      name - The name of the head
      base64 - The base64 texture string of the head
      Returns:
      The ID of the head that was added, or null if unable to add
    • removeHead

      public boolean removeHead(String id)
      Removes a head from the database
      Parameters:
      id - The ID of the head to remove
      Returns:
      true if the head was removed, or false if a head with the ID was not found