Package me.hackware.api.relations
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:
- An entry is not a stance.
byName(java.lang.String)/byUuid(java.util.UUID)/of(net.minecraft.world.entity.player.Player)return an entry for any player ever observed; checkRelation.hasRelation()before treating one as a friend or enemy. - Nothing purges an entry. Clearing a relation only drops the stance — the record and its username history remain.
The client installs its implementation at startup; until then the inert default knows nobody.
-
Method Summary
Modifier and TypeMethodDescriptionall()Every ledger entry, sorted by name — including players who have only been seen online.The ledger entry forname(case-insensitive, matching any username in an entry's history), ornullif this player has never been seen.The ledger entry foruuid, ornullif unknown.enemies()friends()static Relationsget()The installed implementation.booleanisEnemy(net.minecraft.world.entity.player.Player player) booleanisFriend(net.minecraft.world.entity.player.Player player) of(net.minecraft.world.entity.player.Player player) The ledger entry forplayer, ornullif unknown.Only the entries with an explicit friend/enemy stance.booleanshouldAttack(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
The ledger entry forname(case-insensitive, matching any username in an entry's history), ornullif this player has never been seen. -
byUuid
The ledger entry foruuid, ornullif unknown. -
of
The ledger entry forplayer, ornullif 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
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
Only the entries with an explicit friend/enemy stance. -
friends
-
enemies
-
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.
-