Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Killable
An interface for objects that provide information about the entity that killed them.

This abstraction is used to populate the {OBJECT.KILLER} macro field in messages. It allows server operators to define custom or built-in behaviors for logging or describing the cause of death in messages.

The most common implementation source is a LivingEntity, whose getKiller() method returns the killing Entity. However, plugin-defined objects may implement this interface to expose similar semantics.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Predicate<org.bukkit.entity.Entity>
    Predicate that evaluates whether a killer is considered valid and non-blank.
  • Method Summary

    Modifier and Type
    Method
    Description
    Extracts a macro string map with the killer's name, using the given base key and context.
    formatKiller(org.bukkit.entity.Entity killer)
    Formats the killer name for use in placeholder replacement.
    org.bukkit.entity.Entity
    Returns the killer of this object, typically a Player.
  • Field Details

    • VALID_KILLER

      static final Predicate<org.bukkit.entity.Entity> VALID_KILLER
      Predicate that evaluates whether a killer is considered valid and non-blank.
  • Method Details

    • getKiller

      org.bukkit.entity.Entity getKiller()
      Returns the killer of this object, typically a Player.
      Returns:
      the killer as an Entity, or null if not available
    • extractKiller

      default MacroStringMap extractKiller(MacroKey baseKey, AdapterContextContainer ctx)
      Extracts a macro string map with the killer's name, using the given base key and context.
      Parameters:
      baseKey - the macro key that identifies the root placeholder
      ctx - the adapter context container with formatting tools
      Returns:
      a MacroStringMap containing the killer field, or an empty map if not resolvable
    • formatKiller

      static Optional<String> formatKiller(org.bukkit.entity.Entity killer)
      Formats the killer name for use in placeholder replacement.
      Parameters:
      killer - the entity that performed the kill
      Returns:
      an Optional<String> containing the killer's name, if valid