Skip to content

Commit 81f3476

Browse files
add an option to skip fetching the optifine cape
1 parent 0fd303e commit 81f3476

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mcutils-js-api",
3-
"version": "2.0.34",
3+
"version": "2.0.35",
44
"module": "dist/index.js",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,14 @@ export class McUtilsAPI {
133133
* Fetch a player by UUID or username.
134134
*
135135
* @param id the UUID or username of the player (eg: ImFascinated)
136+
* @param fetchOptifineCape whether to fetch the optifine cape (default: true)
136137
* @returns the player or the error (if one occurred)
137138
*/
138139
async fetchPlayer(
139-
id: string
140+
id: string,
141+
fetchOptifineCape: boolean = true
140142
): Promise<{ player?: Player; error?: ErrorResponse }> {
141-
const response = await fetch(`${this.endpoint}/players/${id}`);
143+
const response = await fetch(`${this.endpoint}/players/${id}${this.buildParams({ fetchOptifineCape: String(fetchOptifineCape) })}`);
142144
if (response.ok) {
143145
return {
144146
player: (await response.json()) as Player,

0 commit comments

Comments
 (0)