Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Commit

Permalink
added getBPServer method to player to get the current block party server
Browse files Browse the repository at this point in the history
  • Loading branch information
malte-laukoetter committed Aug 17, 2018
1 parent 6954aca commit 054b39f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ export class Methods {
*/
static RANKS = () => `${Methods.BASE_URL()}/server/ranks`;

/**
* url for a list of the staff members
*/
static BP_SERVER = (uuid: string) => `https://hivemc.com/ajax/getblockpartyserver/${uuid}`;

/**
* url for a list of the staff members
*/
Expand Down
13 changes: 13 additions & 0 deletions lib/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,17 @@ export class Player {
private get requestUuid() : string {
return this.uuid?this.uuid:this.name;
}

/**
* returns the current BlockParty server the player is on
*/
async getBPServer() : Promise<string> {
if(!this.name){
await this.info()
}

const res = await fetch(Methods.BP_SERVER(this.name), 0)

return res.server === 'NONE' ? null : res.server
}
}

0 comments on commit 054b39f

Please sign in to comment.