Enum AvatarType

    • Enum Constant Detail

    • Method Detail

      • values

        public static AvatarType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (AvatarType c : AvatarType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static AvatarType valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • fromId

        public static AvatarType fromId​(int id)
      • getContentType

        @NotNull
        public @NotNull String getContentType()
        Returns:
        the content type for avatars of this type
      • getDirectoryName

        @NotNull
        public @NotNull String getDirectoryName()
        Returns:
        the directory on disk where avatars of this type are stored
      • getId

        public int getId()
        Returns:
        a fixed ID for this avatar type, used for serialization
      • loadDefault

        @NotNull
        public @NotNull AvatarSupplier loadDefault​(@NotNull
                                                   @NotNull String id,
                                                   int size)
        Retrieves a default avatar, potentially randomized based on the requested ID.
        Parameters:
        id - the entity ID for which a default avatar is being requested
        size - the size of the avatar being requested
        Returns:
        a supplier for providing access to the selected default avatar
      • loadFixedDefault

        @NotNull
        public @NotNull AvatarSupplier loadFixedDefault​(int size)
        Retrieves a fixed default avatar, agnostic of any form of identifier. This is primarily intended to simplify retrieving a default avatar in anonymous or unauthorized contexts where a fixed avatar should be returned to prevent leaking information about whether or not a given object exists.
        Parameters:
        size - the size of the avatar being requested
        Returns:
        a supplier providing access to the default avatar
      • buildPath

        @NotNull
        protected abstract @NotNull String buildPath​(@NotNull
                                                     @NotNull String id,
                                                     int size)
        Builds the resource path used to stream the requested default avatar.
        Parameters:
        id - the entity ID, potentially used to randomize the default avatar
        size - the size of the avatar being requested
        Returns:
        the resource path to open to stream the requested default avatar
        Since:
        4.4