Interface IPlayerBuilder


public interface IPlayerBuilder
Fluent builder for synthetic players.
  • Method Details

    • withName

      IPlayerBuilder withName(String name)
      Sets the player name.
      Parameters:
      name - Name to assign.
      Returns:
      This builder.
    • withRandomName

      IPlayerBuilder withRandomName()
      Assigns a generated random name (and associated UUID seed).
      Returns:
      This builder.
    • inWorld

      IPlayerBuilder inWorld(WorldHandle world)
      Places the player in the target world at spawn coordinates.
      Parameters:
      world - Target world.
      Returns:
      This builder.
    • atLocation

      IPlayerBuilder atLocation(WorldHandle world, double x, double y, double z)
      Places the player in the target world at explicit coordinates.
      Parameters:
      world - Target world.
      x - X coordinate.
      y - Y coordinate.
      z - Z coordinate.
      Returns:
      This builder.
    • atSpawn

      IPlayerBuilder atSpawn(WorldHandle world)
      Places the player at the world spawn location.
      Parameters:
      world - Target world.
      Returns:
      This builder.
    • withHealth

      IPlayerBuilder withHealth(double health)
      Sets the synthetic player health value.
      Parameters:
      health - Health to assign.
      Returns:
      This builder.
    • vulnerable

      IPlayerBuilder vulnerable()
      Allows ordinary server damage to affect the synthetic player.

      Synthetic players are invulnerable by default so unrelated survival mechanics cannot make tests nondeterministic. Use this opt-in for tests that explicitly exercise damage or death behavior.

      Returns:
      This builder.
    • withPermissions

      IPlayerBuilder withPermissions(String... permissions)
      Grants permissions to the synthetic player.
      Parameters:
      permissions - Permission nodes.
      Returns:
      This builder.
    • withLocale

      IPlayerBuilder withLocale(String locale)
      Sets the client locale sent during the configuration phase of a full-login join (LK-12).

      Only meaningful with fullLogin(); ignored for the default legacy spawn path.

      Parameters:
      locale - Locale identifier such as "en_us"; must not be blank.
      Returns:
      This builder.
    • fullLogin

      IPlayerBuilder fullLogin()
      Joins the player through the full vanilla login pipeline over real loopback TCP.

      Behavioral differences from the default spawn: the real AsyncPlayerPreLoginEvent, PlayerLoginEvent, and PlayerJoinEvent fire; the server derives the offline UUID from the name (any builder UUID is ignored); and the join can be denied (whitelist/ban/full server), surfaced as a BotJoinDeniedException, or time out as a BotJoinTimeoutException.

      Returns:
      This builder.
    • build

      PlayerHandle build()
      Builds and joins the configured synthetic player.
      Returns:
      The created player handle.