Class ResourcePack

java.lang.Object
com.github.darksoulq.abyssallib.server.resource.ResourcePack

public class ResourcePack extends Object
Handles creation, namespacing, and compilation of a resource pack. Output is written to a ZIP at pluginFolder/pack/output.zip.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Set<String>
     
    static final Map<String,String>
    Tracks SHA1 hashes of compiled packs.
    static final Map<String,UUID>
    Tracks UUIDs for registered packs (used by the sending server).
  • Constructor Summary

    Constructors
    Constructor
    Description
    ResourcePack(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull String pluginId)
    Creates a new resource pack instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    compile(boolean override)
    Compiles and zips the pack contents asynchronously.
     
    @NotNull Path
     
    @NotNull org.bukkit.plugin.Plugin
     
    void
    Autoloads the Icon for this pack from resourcepack/pack.png
    void
    icon(byte[] data)
    Sets the Icon for the pack.
    void
    Sets the pack.mcmeta of this resourcepack
    @NotNull Namespace
    namespace(@NotNull String namespace)
    Returns or creates a namespace container.
    void
    register(boolean override)
    Compiles and registers the pack for sending to players.
    void
    resend(@Nullable List<org.bukkit.entity.Player> players)
    Resends pack to either a list of players or whole server depending on argument Resends to everyone if RSPM is being used instead of builtin server
    void
     

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EXTERNAL_CACHE

      public static final Set<String> EXTERNAL_CACHE
    • UUID_MAP

      public static final Map<String,UUID> UUID_MAP
      Tracks UUIDs for registered packs (used by the sending server).
    • HASH_MAP

      public static final Map<String,String> HASH_MAP
      Tracks SHA1 hashes of compiled packs.
  • Constructor Details

    • ResourcePack

      public ResourcePack(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull String pluginId)
      Creates a new resource pack instance.
      Parameters:
      plugin - Owning plugin
      pluginId - The modid
  • Method Details

    • namespace

      @NotNull public @NotNull Namespace namespace(@NotNull @NotNull String namespace)
      Returns or creates a namespace container.
      Parameters:
      namespace - Domain (e.g. myplugin)
      Returns:
      Namespace container
    • icon

      public void icon(byte[] data)
      Sets the Icon for the pack.
      Parameters:
      data - The icon image data
    • icon

      public void icon()
      Autoloads the Icon for this pack from resourcepack/pack.png
    • mcmeta

      public void mcmeta(PackMcMeta mcmeta)
      Sets the pack.mcmeta of this resourcepack
      Parameters:
      mcmeta - The PackMcMeta instance
    • getNamespaces

      @NotNull public @NotNull Collection<Namespace> getNamespaces()
      Returns:
      All namespaces in this pack
    • getOutputFile

      @NotNull public @NotNull Path getOutputFile()
      Returns:
      Final path to the compiled ZIP
    • getPlugin

      @NotNull public @NotNull org.bukkit.plugin.Plugin getPlugin()
      Returns:
      Owning plugin
    • compile

      public void compile(boolean override)
      Compiles and zips the pack contents asynchronously.
      Parameters:
      override - whether to generate zip if it has been generated before
    • register

      public void register(boolean override)
      Compiles and registers the pack for sending to players.
      Parameters:
      override - whether to generate zip if it has been generated before.
    • unregister

      public void unregister()
    • resend

      public void resend(@Nullable @Nullable List<org.bukkit.entity.Player> players)
      Resends pack to either a list of players or whole server depending on argument Resends to everyone if RSPM is being used instead of builtin server
      Parameters:
      players - The players to send to, or null if to whole server