Interface IPlayerBuilder
public interface IPlayerBuilder
Fluent builder for synthetic players.
-
Method Summary
Modifier and TypeMethodDescriptionatLocation(WorldHandle world, double x, double y, double z) Places the player in the target world at explicit coordinates.atSpawn(WorldHandle world) Places the player at the world spawn location.build()Builds and joins the configured synthetic player.Joins the player through the full vanilla login pipeline over real loopback TCP.inWorld(WorldHandle world) Places the player in the target world at spawn coordinates.Allows ordinary server damage to affect the synthetic player.withHealth(double health) Sets the synthetic player health value.withLocale(String locale) Sets the client locale sent during the configuration phase of a full-login join (LK-12).Sets the player name.withPermissions(String... permissions) Grants permissions to the synthetic player.Assigns a generated random name (and associated UUID seed).
-
Method Details
-
withName
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
Places the player in the target world at spawn coordinates.- Parameters:
world- Target world.- Returns:
- This builder.
-
atLocation
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
Places the player at the world spawn location.- Parameters:
world- Target world.- Returns:
- This builder.
-
withHealth
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
Grants permissions to the synthetic player.- Parameters:
permissions- Permission nodes.- Returns:
- This builder.
-
withLocale
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, andPlayerJoinEventfire; 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 aBotJoinDeniedException, or time out as aBotJoinTimeoutException.- Returns:
- This builder.
-
build
PlayerHandle build()Builds and joins the configured synthetic player.- Returns:
- The created player handle.
-