Record Class Player

java.lang.Object
java.lang.Record
com.botwithus.bot.api.snapshot.Player
Record Components:
serverIndex - server-side player slot
tileX - absolute world tile X
tileY - absolute world tile Y
plane - 0..3
flags - bitset; bit 0 = moving (see isMoving())
followingIndex - server index of the follow target, or -1
animationId - current animation id, or -1
stanceId - current stance id
combatLevel - combat level, or 0 if not computed
spotAnimId - first active spot anim (graphic) id, or -1 if none

public record Player(int serverIndex, int tileX, int tileY, int plane, int flags, int followingIndex, int animationId, int stanceId, int combatLevel, int spotAnimId, Orientation orientation) extends Record
Snapshot of one player at the producer's current tick.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Player(int serverIndex, int tileX, int tileY, int plane, int flags, int followingIndex, int animationId, int stanceId, int combatLevel, int spotAnimId)
    Builds a row with an unknown facing; kept so pre-v21 callers compile unchanged.
    Player(int serverIndex, int tileX, int tileY, int plane, int flags, int followingIndex, int animationId, int stanceId, int combatLevel, int spotAnimId, Orientation orientation)
    Creates an instance of a Player record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the animationId record component.
    int
    Returns the value of the combatLevel record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the flags record component.
    int
    Returns the value of the followingIndex record component.
    final int
    Returns a hash code value for this object.
    boolean
     
    Returns the value of the orientation record component.
    int
    Returns the value of the plane record component.
    int
    Returns the value of the serverIndex record component.
    int
    Returns the value of the spotAnimId record component.
    int
    Returns the value of the stanceId record component.
    int
    Returns the value of the tileX record component.
    int
    Returns the value of the tileY record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Player

      public Player(int serverIndex, int tileX, int tileY, int plane, int flags, int followingIndex, int animationId, int stanceId, int combatLevel, int spotAnimId)
      Builds a row with an unknown facing; kept so pre-v21 callers compile unchanged.
    • Player

      public Player(int serverIndex, int tileX, int tileY, int plane, int flags, int followingIndex, int animationId, int stanceId, int combatLevel, int spotAnimId, Orientation orientation)
      Creates an instance of a Player record class.
      Parameters:
      serverIndex - the value for the serverIndex record component
      tileX - the value for the tileX record component
      tileY - the value for the tileY record component
      plane - the value for the plane record component
      flags - the value for the flags record component
      followingIndex - the value for the followingIndex record component
      animationId - the value for the animationId record component
      stanceId - the value for the stanceId record component
      combatLevel - the value for the combatLevel record component
      spotAnimId - the value for the spotAnimId record component
      orientation - the value for the orientation record component
  • Method Details

    • isMoving

      public boolean isMoving()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • serverIndex

      public int serverIndex()
      Returns the value of the serverIndex record component.
      Returns:
      the value of the serverIndex record component
    • tileX

      public int tileX()
      Returns the value of the tileX record component.
      Returns:
      the value of the tileX record component
    • tileY

      public int tileY()
      Returns the value of the tileY record component.
      Returns:
      the value of the tileY record component
    • plane

      public int plane()
      Returns the value of the plane record component.
      Returns:
      the value of the plane record component
    • flags

      public int flags()
      Returns the value of the flags record component.
      Returns:
      the value of the flags record component
    • followingIndex

      public int followingIndex()
      Returns the value of the followingIndex record component.
      Returns:
      the value of the followingIndex record component
    • animationId

      public int animationId()
      Returns the value of the animationId record component.
      Returns:
      the value of the animationId record component
    • stanceId

      public int stanceId()
      Returns the value of the stanceId record component.
      Returns:
      the value of the stanceId record component
    • combatLevel

      public int combatLevel()
      Returns the value of the combatLevel record component.
      Returns:
      the value of the combatLevel record component
    • spotAnimId

      public int spotAnimId()
      Returns the value of the spotAnimId record component.
      Returns:
      the value of the spotAnimId record component
    • orientation

      public Orientation orientation()
      Returns the value of the orientation record component.
      Returns:
      the value of the orientation record component