Interface Relations


public interface Relations
Read-only view of the relations ledger — friends, enemies, and every player ever seen online.

This is the same ledger the built-in modules consult (nametags, ESP, target selection). It is deliberately read-only: relations are managed by the user through the Relations tab and .relations, not by plugins.

Lookups are cheap (indexed, no scanning) and safe on hot paths — the built-ins call them from render loops and combat target selection. All methods must be called from the client thread.

Two ledger semantics to keep in mind:

The client installs its implementation at startup; until then the inert default knows nobody.

  • Method Summary

    Modifier and Type
    Method
    Description
    all()
    Every ledger entry, sorted by name — including players who have only been seen online.
    byName(String name)
    The ledger entry for name (case-insensitive, matching any username in an entry's history), or null if this player has never been seen.
    byUuid(UUID uuid)
    The ledger entry for uuid, or null if unknown.
     
     
    static Relations
    get()
    The installed implementation.
    boolean
    isEnemy(net.minecraft.world.entity.player.Player player)
     
    boolean
    isFriend(net.minecraft.world.entity.player.Player player)
     
    of(net.minecraft.world.entity.player.Player player)
    The ledger entry for player, or null if unknown.
    Only the entries with an explicit friend/enemy stance.
    boolean
    shouldAttack(net.minecraft.world.entity.player.Player player)
    The target-selection policy the built-in combat modules use: attack anyone who is not a friend — and a friend anyway if they are also an enemy.
  • Method Details

    • byName

      Relation byName(String name)
      The ledger entry for name (case-insensitive, matching any username in an entry's history), or null if this player has never been seen.
    • byUuid

      Relation byUuid(UUID uuid)
      The ledger entry for uuid, or null if unknown.
    • of

      Relation of(net.minecraft.world.entity.player.Player player)
      The ledger entry for player, or null if unknown.
    • isFriend

      boolean isFriend(net.minecraft.world.entity.player.Player player)
    • isEnemy

      boolean isEnemy(net.minecraft.world.entity.player.Player player)
    • shouldAttack

      boolean shouldAttack(net.minecraft.world.entity.player.Player player)
      The target-selection policy the built-in combat modules use: attack anyone who is not a friend — and a friend anyway if they are also an enemy.
    • all

      List<Relation> all()
      Every ledger entry, sorted by name — including players who have only been seen online. On a busy server this reaches thousands of entries; prefer the indexed lookups above on hot paths.
    • relations

      List<Relation> relations()
      Only the entries with an explicit friend/enemy stance.
    • friends

      List<Relation> friends()
    • enemies

      List<Relation> enemies()
    • get

      static Relations get()
      The installed implementation. The install point lives outside the exported SDK surface, so plugins can read the ledger but never swap the implementation behind it.