Skip to content

@loontail/minecraft-kit v0.8.14 / asPlayerUuid

Function: asPlayerUuid()

ts
function asPlayerUuid(raw): PlayerUuid

Validate raw as a Minecraft player UUID and brand it as PlayerUuid. Throws MinecraftKitError(INVALID_INPUT) when the input is empty after trimming. The constructor does not enforce a specific UUID shape — Mojang accepts both dashed and undashed forms in different APIs — but it does reject the empty string so a missing storage entry can't quietly become a UUID-shaped placeholder.

Parameters

ParameterType
rawstring

Returns

PlayerUuid

Example

ts
import { asPlayerUuid } from "@loontail/minecraft-kit";

const uuid = asPlayerUuid(await storage.load("player-uuid"));

Source

src/core/uuid.ts:20

MIT License