Players
Resolve players and apply server-owned player mutations through handles.
In this section
Related section pages:
Lookup
Use ctx.Gameplay().Players() to resolve players by name, ID, XUID, UUID, or active session identity.
players.go
playerHandle, ok := ctx.Gameplay().Players().ByName("Steve")if !ok { return fmt.Errorf("player not found")}target, ok := ctx.Gameplay().Players().Resolve("Steve") // ID, name, XUID, or UUID_ = target_ = ok_, err := playerHandle.Inventory().Give(item.New("diamond_sword"). Enchant(item.Sharpness(5)). NameTag("Arena Blade"). Stack())worldHandle, ok := ctx.Gameplay().Worlds().ByName("Hub")if !ok { return fmt.Errorf("world not found")}container := worldHandle.ContainerAt(world.Pos{X: 10, Y: 64, Z: 10}, 27)_, err = container.Give(item.New("diamond").Count(8).Stack())Player State
Player handles expose identity, locale, device, skin profile, full skin snapshots, motion, network, inventory, forms, scoreboards, and runtime actions.
motion-network.go
motion, ok := playerHandle.Motion()_ = motion_ = okerr := playerHandle.SetMotion(entity.Motion{X: 0.2, Y: 0.42, Z: 0})_, err = playerHandle.Knockback(entity.Position{X: 0, Y: 64, Z: 0}, 0.4, 0.36)network, ok := playerHandle.Network()locale, _ := playerHandle.Locale()device, _ := playerHandle.Device()skinProfile, _ := playerHandle.SkinProfile()skin, err := playerHandle.Skin()_, err = playerHandle.SetSkin(skin)_ = network_ = ok_ = locale_ = device_ = skinProfile_ = skin