Class BetterModel

java.lang.Object
kr.toxicity.model.api.BetterModel

public final class BetterModel extends Object
The main entry point for the BetterModel API.

This class provides static access to the plugin instance, configuration, model managers, NMS handlers, and entity registries. It serves as a service provider for interacting with the BetterModel engine.

Since:
1.15.2
  • Field Details

    • IS_FOLIA

      public static final boolean IS_FOLIA
      Checks if the server is running on the Folia platform.
      Since:
      1.15.2
    • IS_PURPUR

      public static final boolean IS_PURPUR
      Checks if the server is running on the Purpur platform.
      Since:
      1.15.2
    • IS_PAPER

      public static final boolean IS_PAPER
      Checks if the server is running on the Paper platform (or a fork like Purpur/Folia).
      Since:
      1.15.2
  • Method Details

    • config

      @NotNull public static @NotNull BetterModelConfig config()
      Returns the plugin configuration manager.
      Returns:
      the configuration manager
      Since:
      1.15.2
    • model

      @NotNull public static @NotNull Optional<ModelRenderer> model(@NotNull @NotNull String name)
      Retrieves a model renderer by its name, wrapped in an Optional.
      Parameters:
      name - the name of the model
      Returns:
      an optional containing the renderer if found
      Since:
      1.15.2
    • modelOrNull

      @Nullable public static @Nullable ModelRenderer modelOrNull(@NotNull @NotNull String name)
      Retrieves a model renderer by its name, or null if not found.
      Parameters:
      name - the name of the model
      Returns:
      the renderer, or null
      Since:
      1.15.2
    • limb

      @NotNull public static @NotNull Optional<ModelRenderer> limb(@NotNull @NotNull String name)
      Retrieves a player limb renderer by its name, wrapped in an Optional.
      Parameters:
      name - the name of the limb model
      Returns:
      an optional containing the renderer if found
      Since:
      1.15.2
    • limbOrNull

      @Nullable public static @Nullable ModelRenderer limbOrNull(@NotNull @NotNull String name)
      Retrieves a player limb renderer by its name, or null if not found.
      Parameters:
      name - the name of the limb model
      Returns:
      the renderer, or null
      Since:
      1.15.2
    • player

      @NotNull public static @NotNull Optional<PlayerChannelHandler> player(@NotNull @NotNull UUID uuid)
      Retrieves a player channel handler by the player's UUID.
      Parameters:
      uuid - the player's UUID
      Returns:
      an optional containing the channel handler if found
      Since:
      1.15.2
    • registry

      @NotNull public static @NotNull Optional<EntityTrackerRegistry> registry(@NotNull @NotNull UUID uuid)
      Retrieves an entity tracker registry by the entity's UUID.
      Parameters:
      uuid - the entity's UUID
      Returns:
      an optional containing the registry if found
      Since:
      1.15.2
    • registry

      @NotNull public static @NotNull Optional<EntityTrackerRegistry> registry(@NotNull @NotNull org.bukkit.entity.Entity entity)
      Retrieves an entity tracker registry for a Bukkit entity.
      Parameters:
      entity - the Bukkit entity
      Returns:
      an optional containing the registry if found
      Since:
      1.15.2
    • registry

      @NotNull public static @NotNull Optional<EntityTrackerRegistry> registry(@NotNull @NotNull BaseEntity entity)
      Retrieves an entity tracker registry for a base entity.
      Parameters:
      entity - the base entity
      Returns:
      an optional containing the registry if found
      Since:
      1.15.2
    • registryOrNull

      @Nullable public static @Nullable EntityTrackerRegistry registryOrNull(@NotNull @NotNull UUID uuid)
      Retrieves an entity tracker registry by the entity's UUID, or null if not found.
      Parameters:
      uuid - the entity's UUID
      Returns:
      the registry, or null
      Since:
      1.15.2
    • registryOrNull

      @Nullable public static @Nullable EntityTrackerRegistry registryOrNull(@NotNull @NotNull org.bukkit.entity.Entity entity)
      Retrieves an entity tracker registry for a Bukkit entity, or null if not found.
      Parameters:
      entity - the Bukkit entity
      Returns:
      the registry, or null
      Since:
      1.15.2
    • registryOrNull

      @Nullable public static @Nullable EntityTrackerRegistry registryOrNull(@NotNull @NotNull BaseEntity entity)
      Retrieves an entity tracker registry for a base entity, or null if not found.
      Parameters:
      entity - the base entity
      Returns:
      the registry, or null
      Since:
      1.15.2
    • models

      @NotNull public static @NotNull @Unmodifiable Collection<ModelRenderer> models()
      Returns a collection of all loaded model renderers.
      Returns:
      an unmodifiable collection of models
      Since:
      1.15.2
    • limbs

      @NotNull public static @NotNull @Unmodifiable Collection<ModelRenderer> limbs()
      Returns a collection of all loaded player limb renderers.
      Returns:
      an unmodifiable collection of limb models
      Since:
      1.15.2
    • modelKeys

      @NotNull public static @NotNull @Unmodifiable Set<String> modelKeys()
      Returns a set of all loaded model names.
      Returns:
      an unmodifiable set of model keys
      Since:
      1.15.2
    • limbKeys

      @NotNull public static @NotNull @Unmodifiable Set<String> limbKeys()
      Returns a set of all loaded player limb model names.
      Returns:
      an unmodifiable set of limb keys
      Since:
      1.15.2
    • plugin

      @NotNull public static @NotNull BetterModelPlugin plugin()
      Returns the singleton instance of the BetterModel plugin.
      Returns:
      the plugin instance
      Throws:
      NullPointerException - if the plugin has not been initialized
      Since:
      1.15.2
      See Also:
      • JavaPlugin
    • nms

      @NotNull public static @NotNull NMS nms()
      Returns the NMS handler instance.
      Returns:
      the NMS handler
      Since:
      1.15.2
    • register

      @Internal public static void register(@NotNull @NotNull BetterModelPlugin instance)
      Registers the plugin instance.

      This method is intended for internal use only during plugin initialization.

      Parameters:
      instance - the plugin instance
      Throws:
      RuntimeException - if an instance is already registered
      Since:
      1.15.2