Interface LeashFlag


public interface LeashFlag
A single condition that must be satisfied before a player can leash (tame) a mob as a pet. Implementations are registered with LeashFlagManager and discovered by their LeashFlagName annotation.

Multiple flags may be configured per pet type in the skilltree; all configured flags must pass for the leash attempt to succeed.

Implementations range from simple state checks (BabyFlag, TamedFlag) to integration gates that defer to external plugins (WorldGuardFlag, MythicMobsFlag).

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    check(Player player, LivingEntity entity, double damage, Settings settings)
    Evaluates whether this leash condition is met for the given player/entity pair.
    static Component
    getComponentPrefix(boolean right)
    Returns a colored prefix component for use in player-facing feedback messages: a green checkmark (✔) when the flag passes, or a red cross (✘) when it fails.
    default Component
    getMissingMessage(Player player, LivingEntity entity, double damage, Settings settings)
    Returns a player-facing message explaining why this flag failed, shown when the leash attempt is denied.
    default boolean
    If true, the /petinfo helper display skips this flag - useful for flags that are always-pass or purely internal.
  • Method Details

    • getComponentPrefix

      static Component getComponentPrefix(boolean right)
      Returns a colored prefix component for use in player-facing feedback messages: a green checkmark (✔) when the flag passes, or a red cross (✘) when it fails.
      Parameters:
      right - true for pass (green ✔), false for fail (red ✘)
      Returns:
      the prefix component
    • check

      boolean check(Player player, LivingEntity entity, double damage, Settings settings)
      Evaluates whether this leash condition is met for the given player/entity pair.
      Parameters:
      player - the player attempting to leash the mob
      entity - the mob being leashed
      damage - the final damage dealt to the mob in the leash hit (some flags gate on minimum damage)
      settings - flag-specific parameters from the skilltree config (e.g. required size, chance percentage)
      Returns:
      true if this condition passes
    • getMissingMessage

      default Component getMissingMessage(Player player, LivingEntity entity, double damage, Settings settings)
      Returns a player-facing message explaining why this flag failed, shown when the leash attempt is denied. Return null (the default) to suppress feedback for this flag.
      Parameters:
      player - the player whose leash attempt was denied
      entity - the mob they tried to leash
      damage - the damage dealt in the leash hit
      settings - this flag's parameters from the config
      Returns:
      the message to show, or null to stay silent
    • ignoredByHelper

      default boolean ignoredByHelper()
      If true, the /petinfo helper display skips this flag - useful for flags that are always-pass or purely internal.
      Returns:
      true to hide this flag from the capture helper