Update sdk/js/player/query
parent
190a36d9ad
commit
f976a112f2
@ -5,6 +5,12 @@
|
||||
import { CachedPlayer } from "restfulmc-lib";
|
||||
import { getPlayer } from "restfulmc-lib";
|
||||
|
||||
const player: CachedPlayer = await getPlayer("Username or UUID");
|
||||
console.log(`Hello ${player.username}, your UUID is ${player.uniqueId}!`);
|
||||
try {
|
||||
const player: CachedPlayer = await getPlayer("Rainnny");
|
||||
console.log(`Hello ${player.username}, your UUID is ${player.uniqueId}!`);
|
||||
} catch (err) {
|
||||
if ((err as ErrorResponse).code == 404) {
|
||||
console.error("Player with UUID or username not found.");
|
||||
}
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user