Class PackObject


  • public class PackObject
    extends java.lang.Object
    Represents a pack object. A pack object represents an object in a pack.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static @NotNull java.util.regex.Pattern IDENTIFIER_PATTERN  
      static @NotNull java.util.regex.Pattern NAME_PATTERN  
    • Constructor Summary

      Constructors 
      Constructor Description
      PackObject​(@NotNull java.lang.String identifier)
      Create a pack object from an identifier.
      PackObject​(@NotNull org.bukkit.NamespacedKey key)
      Create a new pack object from a namespaced key.
      PackObject​(java.lang.String namespace, java.lang.String name)
      Create a pack object from a namespace and a name
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends PackAsset>
      T
      getAsset​(java.lang.Class<T> type)
      Returns a block asset that can be found with this namespace and name
      @Nullable java.lang.Integer getCustomModel()
      Returns a custom model that can be found with this namespace and name.
      <T extends CustomPackAsset>
      @Nullable CustomGenerator<T>
      getGenerator​(java.lang.Class<T> type)  
      java.lang.String getName()
      Returns the name of the pack object
      java.lang.String getNamespace()
      Returns the namespaced key of the pack object
      @Nullable ItemModsPack getPack()
      Returns the pack of the pack object
      CustomTemplate getTemplate()  
      void save()
      Saves the pack where the pack object is located
      @NotNull java.lang.String toString()
      This method returns the identifier of the pack object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • IDENTIFIER_PATTERN

        @NotNull
        public static final @NotNull java.util.regex.Pattern IDENTIFIER_PATTERN
      • NAME_PATTERN

        @NotNull
        public static final @NotNull java.util.regex.Pattern NAME_PATTERN
    • Constructor Detail

      • PackObject

        public PackObject​(java.lang.String namespace,
                          java.lang.String name)
        Create a pack object from a namespace and a name
        Parameters:
        namespace - The namespace of the pack
        name - The name of the pack
      • PackObject

        public PackObject​(@NotNull
                          @NotNull java.lang.String identifier)
                   throws java.lang.UnsupportedOperationException
        Create a pack object from an identifier. This identifier is a namespace:name string. The string should be lowercase and have no spaces.
        Parameters:
        identifier - The identifier to create the pack object from
        Throws:
        java.lang.UnsupportedOperationException - If the identifier is not a valid identifier
      • PackObject

        public PackObject​(@NotNull
                          @NotNull org.bukkit.NamespacedKey key)
        Create a new pack object from a namespaced key.
        Parameters:
        key - The namespaced key to create the pack object from
    • Method Detail

      • getNamespace

        public java.lang.String getNamespace()
        Returns the namespaced key of the pack object
        Returns:
        The namespaced key of the pack object
      • getName

        public java.lang.String getName()
        Returns the name of the pack object
        Returns:
        The name of the pack object
      • getPack

        @Nullable
        public @Nullable ItemModsPack getPack()
        Returns the pack of the pack object
        Returns:
        The pack of the pack object
      • getAsset

        @Nullable
        public <T extends PackAsset> T getAsset​(java.lang.Class<T> type)
        Returns a block asset that can be found with this namespace and name
        Returns:
        A block asset or null if it does not exist
      • getCustomModel

        @Nullable
        public @Nullable java.lang.Integer getCustomModel()
        Returns a custom model that can be found with this namespace and name. It generates when the pack will get exported. The method looks in the MainConfig for the custom model.
        Returns:
        A custom model or null if it does not exist
      • save

        public void save()
        Saves the pack where the pack object is located
      • toString

        @NotNull
        public @NotNull java.lang.String toString()
        This method returns the identifier of the pack object. It is a string in the format of namespace:name
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation of the pack object