Interface PlayerHeadsAPI


  • public interface PlayerHeadsAPI
    Interface for the PlayerHeads API. This interface defines each method that the PlayerHeads API provides.
    Author:
    crashdemons (crashenator at gmail.com)
    • Method Detail

      • getPlugin

        @Nullable
        PlayerHeadsPlugin getPlugin()
        Get the main PlayerHeads Plugin instance
        Returns:
        the PlayerHeads plugin object, or null if unavailable.
      • getVersion

        @Nullable
        String getVersion()
        Get the version of the PlayerHeads plugin in use
        Returns:
        the version of the PlayerHeads plugin in use
      • getHeadFrom

        @Nullable
        HeadType getHeadFrom​(ItemStack s)
        Gets the type of head associated with an itemstack.
        Parameters:
        s - the itemstack to check
        Returns:
        the type of head, or null if there is none
      • getHeadFrom

        @Nullable
        HeadType getHeadFrom​(BlockState s)
        Gets the type of head associated with the Block
        Parameters:
        s - the blockstate to check
        Returns:
        the type of head, or null if the block wasn't a head.
      • getHeadOf

        @Nullable
        HeadType getHeadOf​(Entity e)
        Gets the type of head associated with an entity
        Parameters:
        e - the entity to check
        Returns:
        the type of head, or null if there is no viable head.
      • getHeadOf

        @Nullable
        HeadType getHeadOf​(EntityType t)
        Deprecated.
        this may not do exactly what you want because between MC 1.10-1.13 many entities were separated from variants to their own entity-type. Using this method will introduce version-dependent behavior (For example: this may not be able to tell a stray from a skeleton in certain server versions) and should be avoided by using getHeadFrom(Entity) instead.
        Gets the type of head associated with an entity-type. See deprecation note for limitations.
        Parameters:
        t - the entity type to check
        Returns:
        the type of head, or null if there is no viable head (unsupported mob)
        See Also:
        getHeadDrop(org.bukkit.entity.Entity)
      • getHeadItem

        @Nullable
        ItemStack getHeadItem​(HeadType h,
                              int num)
        Gets a stack of head items for the given type and amount. Note: player-type heads will be untextured and have no set owner with this method. This is affected by configuration settings like "dropvanillaheads" and "addlore".
        Parameters:
        h - the head type to create items of
        num - the number of items to create
        Returns:
        The item stack, or null if the head type was null
      • getHeadDrop

        @Nullable
        ItemStack getHeadDrop​(Entity e)
        Gets a stack of head items as they would normally be dropped from the given entity. Note: this method takes into full account plugin configuration settings, player's name, and preset item drop amount
        Parameters:
        e - the entity to create items from
        Returns:
        The item stack, or null if the entity head type was null (unsupported mob).
      • getBoringPlayerheadItem

        @NotNull
        ItemStack getBoringPlayerheadItem​(int num)
        Gets a "boring" playerhead without an owner as if "dropboringplayerheads" was enabled. This head is provided without manipulation by configuration settings except 'addlore'.
        Parameters:
        num - number of head items to get
        Returns:
        the item stack requested
        Since:
        5.1.1-SNAPSHOT
      • getHeadItem

        @NotNull
        ItemStack getHeadItem​(String username,
                              int num,
                              boolean forceOwner)
        Gets the playerhead for the user provided. This head is provided subject to configuration settings like 'dropboringplayerheads' and 'addlore'
        Parameters:
        username - the username for the playerhead
        num - number of items to include of the head
        forceOwner - if true, ignore the state of 'dropboringplayerheads' and provide a head for the owner anyway
        Returns:
        the itemstack requested
        Since:
        5.1.1-SNAPSHOT
      • getHeadItem

        @Nullable
        ItemStack getHeadItem​(OfflinePlayer player,
                              int num,
                              boolean forceOwner)
        Gets the playerhead for the user provided. This head is provided subject to configuration settings like 'dropboringplayerheads' and 'addlore' Note: this is based on username lookup.
        Parameters:
        player - the player to retrieve a head for
        num - number of items to include of the head
        forceOwner - if true, ignore the state of 'dropboringplayerheads' and provide a head for the owner anyway
        Returns:
        the itemstack requested, or null if the username could not be determined.
        Since:
        5.1.1-SNAPSHOT
      • getCompatibilityProvider

        @Nullable
        @Deprecated
        com.github.crashdemons.playerheads.compatibility.CompatibilityProvider getCompatibilityProvider()
        Deprecated.
        You should use Compatibility.getProvider() from PlayerHeads-compatibility-api. Compatibility packages will be removed from PH-API in the future, but you may still access them if you use PlayerHeads-compatibility-api (or lib) as a dependency.
        Gets an instance of a class that provides many useful crossversion PlayerHeads capabilities that would normally be version-specific. For example: viewing and editing ownership information for skinned playerheads. These may be more subject to change than other API methods, so you should avoid them except when necessary.
        Returns:
        the CompatibilityProvider instance or null if PlayerHeads plugin was not initialized yet.
        Since:
        5.1.1-SNAPSHOT
      • getSupportedHeads

        HeadType[] getSupportedHeads()
        Gets an array of all heads defined by PlayerHeads
        Returns:
        an array of headtypes
        Since:
        5.2.14-SNAPSHOT