Interface Trail


public interface Trail
Represents a Trail instance for a specific player.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull org.bukkit.OfflinePlayer
    Returns the player associated with this trail.
    @NotNull UUID
    Returns the UUID of the player associated with the trail.
    @Nullable org.bukkit.Color
    This method is nullable because if the value of isGradient() is true, then getColors() should be used instead, as that will contain the color data for our trail.
    @Nullable Set<org.bukkit.Color>
    This method is nullable because if the value of isGradient() is false, then getColor() should be used instead, as our trail is a single static color.
    @NotNull TrailType
    Gets the Trail Type of this trail.
    boolean
    Gets whether the trail is active.
    boolean
    Validates whether this Trail is a gradient or a static trail.
    void
    setActive(boolean active)
    Turn the trail on or off.
    void
    setColor(@NotNull org.bukkit.Color color)
    Sets the static color of the trail.
    void
    setColors(@NotNull Set<org.bukkit.Color> colors)
    Sets the colors of the trail.
    void
    Spawns a particle (if gradient, the next particle) on the supplied location object.
  • Method Details

    • getAssociatedPlayerUUID

      @NotNull @NotNull UUID getAssociatedPlayerUUID()
      Returns the UUID of the player associated with the trail. This is for usage with our persistant storage container so that we can safely send and retrieve the trails without having to directly reference a player object.
      TL;DR Memory optimization!
      Returns:
      The UUID of the player associated with this trail.
    • getAssociatedPlayer

      @NotNull @NotNull org.bukkit.OfflinePlayer getAssociatedPlayer()
      Returns the player associated with this trail. Trails are user specific, and should be persistent across all usages. This is also used when displaying the particles, as they will be relative to the player's back, which is an inverse offset of the player's eye location. We use OfflinePlayer as we can make a simple check and cast to determine if the player is online when spawning trails.
      Returns:
      The player associated with this Trail.
    • getTrailType

      @NotNull @NotNull TrailType getTrailType()
      Gets the Trail Type of this trail. This is used to determine what type of trail this is, and what Particle it should use.
      Returns:
      The Trail Type of this trail.
      See Also:
    • getColor

      @Nullable @Nullable org.bukkit.Color getColor()
      This method is nullable because if the value of isGradient() is true, then getColors() should be used instead, as that will contain the color data for our trail.
      However, this method will also be null if the particle type is not colorable.
      Returns:
      The color of the trail, or null if the trail is a gradient or non-colorable.
      See Also:
    • setColor

      void setColor(@NotNull @NotNull org.bukkit.Color color)
      Sets the static color of the trail. If you are trying to use a gradient, use setColors(Set) instead.
      Parameters:
      color - The color to set the trail to.
    • getColors

      @Nullable @Nullable Set<org.bukkit.Color> getColors()
      This method is nullable because if the value of isGradient() is false, then getColor() should be used instead, as our trail is a single static color.
      However, this method will also be null if the particle type is not colorable.
      Returns:
      The colors of the trail, or null if the trail is not a gradient or non-colorable.
      See Also:
    • setColors

      void setColors(@NotNull @NotNull Set<org.bukkit.Color> colors)
      Sets the colors of the trail. If you are trying to use a static color, use setColor(Color) instead.
      This should be used for trails that iterate over a set of colors, such as a rainbow trail.
      Parameters:
      colors - The colors to set the trail to. It is recommended to use InterpolationUtils to generate interpolated gradients for this.
    • isGradient

      boolean isGradient()
      Validates whether this Trail is a gradient or a static trail.
      This is entirely based on whether getColors() returns null or not.
      Returns:
      True if getColors() is not null, false otherwise.
    • isActive

      boolean isActive()
      Gets whether the trail is active.
      Returns:
      True if the trail is active, false if it is not.
    • setActive

      void setActive(boolean active)
      Turn the trail on or off.
      Parameters:
      active - True if the trail should be active, false if it should not.
    • spawnParticle

      void spawnParticle()
      Spawns a particle (if gradient, the next particle) on the supplied location object.