Class CustomAnimationHandlerType

java.lang.Object
de.marcely.bedwars.api.cosmetics.animation.custom.CustomAnimationHandlerType

public abstract class CustomAnimationHandlerType extends Object
Represents a type of handler that has been created using the API.

Extend this class and call CosmeticsAPI.registerCustomHandlerType(CustomAnimationHandlerType) to create your own custom animation handler!

  • Constructor Details

    • CustomAnimationHandlerType

      public CustomAnimationHandlerType(String name, Plugin plugin)
      Replace the parameters with your own information
      Parameters:
      name - The name of the handler that can be accessed using "custom-type-name" in configs
      plugin - Your plugin that is creating this type
  • Method Details

    • getName

      public final String getName()
      Get the name of this custom handler type.

      This one is used for "custom-type-name" in configs.

      Returns:
      The name of this type that was passed in its constructor
    • getPlugin

      public final Plugin getPlugin()
      Get the plugin that is managing this handler type.
      Returns:
      The plugin behind this custom type
    • isPeriodic

      public abstract boolean isPeriodic()
      Get whether this handler type can be repeated frequently.

      E.g. if your handler would spawn particles, and you implement CustomAnimationHandlerSession.handleTick(int), this method should return true since it's possible to define a frequency in configs (basically how often per second it shall spawn a particle).

      For something else, such as spawning a complex, long-living entity, this method may return false. In this case CustomAnimationHandlerSession.handleTick(int) is never called.

      Returns:
      Whether this handler type may be ticked
    • openSession

      Gets called when the handler shall do its thing.

      Example: Play kills somebody during a match and has a kill animation set. The animation has a list of handlers (Animation.getHandlers()), one of which is this custom type. Now for all handlers a session is created, including this one, which represents the lifecycle of the handlers doings.

      You may immediately start your logic when this is called, such as spawning entities or whatever you want to do.

      Parameters:
      info - All the info neccessary to display the handler's animation
      Returns:
      The constructed session by you