hive-bedrock-api 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +115 -0
- package/lib/index.js +495 -0
- package/lib/processors/game.d.ts +293 -0
- package/lib/processors/game.js +396 -0
- package/lib/processors/global_statistics.d.ts +9 -0
- package/lib/processors/global_statistics.js +2 -0
- package/lib/processors/map.d.ts +8 -0
- package/lib/processors/map.js +2 -0
- package/lib/processors/meta.d.ts +45 -0
- package/lib/processors/meta.js +2 -0
- package/lib/processors/player.d.ts +62 -0
- package/lib/processors/player.js +55 -0
- package/lib/processors/player_search.d.ts +6 -0
- package/lib/processors/player_search.js +11 -0
- package/lib/utils.d.ts +21 -0
- package/lib/utils.js +2 -0
- package/package.json +4 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface ProcessedGameMetadata {
|
|
2
|
+
name: string;
|
|
3
|
+
shortName: string;
|
|
4
|
+
maxLevel: number;
|
|
5
|
+
allowPrestiging: boolean;
|
|
6
|
+
maxPrestige: number;
|
|
7
|
+
experienceToLevel: {
|
|
8
|
+
[xp: number]: number;
|
|
9
|
+
};
|
|
10
|
+
levelUnlocks: {
|
|
11
|
+
[level: number]: LevelUnlock[];
|
|
12
|
+
};
|
|
13
|
+
levelUnlockTypes: {
|
|
14
|
+
[type: string]: {
|
|
15
|
+
name: string;
|
|
16
|
+
icon: string | null;
|
|
17
|
+
default: string | null;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export type LevelUnlock = {
|
|
22
|
+
name: string;
|
|
23
|
+
icon: string | null;
|
|
24
|
+
type: string;
|
|
25
|
+
global: false;
|
|
26
|
+
} & ({
|
|
27
|
+
global: false;
|
|
28
|
+
} | {
|
|
29
|
+
global: true;
|
|
30
|
+
globalCosmetic: GlobalUnlock;
|
|
31
|
+
});
|
|
32
|
+
export type GlobalUnlock = GlobalTitleUnlock | GlobalAvatarUnlock | GlobalCostumeUnlock;
|
|
33
|
+
export interface GlobalTitleUnlock {
|
|
34
|
+
type: "hub_title";
|
|
35
|
+
display: string;
|
|
36
|
+
}
|
|
37
|
+
export interface GlobalAvatarUnlock {
|
|
38
|
+
type: "avatar";
|
|
39
|
+
name: string;
|
|
40
|
+
url: string;
|
|
41
|
+
}
|
|
42
|
+
export interface GlobalCostumeUnlock {
|
|
43
|
+
type: "costume";
|
|
44
|
+
name: string;
|
|
45
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface ProcessedPlayerResponse {
|
|
2
|
+
info: {
|
|
3
|
+
uuid: string;
|
|
4
|
+
xuid: string;
|
|
5
|
+
mcid: string;
|
|
6
|
+
username: string;
|
|
7
|
+
rank: string;
|
|
8
|
+
first_played: number;
|
|
9
|
+
login_streak: {
|
|
10
|
+
current: number;
|
|
11
|
+
longest: number;
|
|
12
|
+
};
|
|
13
|
+
friend_count: number;
|
|
14
|
+
quest_count: number;
|
|
15
|
+
};
|
|
16
|
+
equipped_cosmetics: {
|
|
17
|
+
costume: CosmeticResponseTypes[CosmeticType.Costume];
|
|
18
|
+
avatar: CosmeticResponseTypes[CosmeticType.Avatar];
|
|
19
|
+
hub_title: CosmeticResponseTypes[CosmeticType.HubTitle];
|
|
20
|
+
hat: CosmeticResponseTypes[CosmeticType.Hat];
|
|
21
|
+
backbling: CosmeticResponseTypes[CosmeticType.Backbling];
|
|
22
|
+
};
|
|
23
|
+
owned_cosmetics: {
|
|
24
|
+
costume: CosmeticResponseTypes[CosmeticType.Costume][];
|
|
25
|
+
avatar: CosmeticResponseTypes[CosmeticType.Avatar][];
|
|
26
|
+
hub_title: CosmeticResponseTypes[CosmeticType.HubTitle][];
|
|
27
|
+
hat: CosmeticResponseTypes[CosmeticType.Hat][];
|
|
28
|
+
pet: CosmeticResponseTypes[CosmeticType.Pet][];
|
|
29
|
+
mount: CosmeticResponseTypes[CosmeticType.Mount][];
|
|
30
|
+
backbling: CosmeticResponseTypes[CosmeticType.Backbling][];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export declare enum CosmeticType {
|
|
34
|
+
Costume = "costume",
|
|
35
|
+
Avatar = "avatar",
|
|
36
|
+
HubTitle = "hub_title",
|
|
37
|
+
Hat = "hat",
|
|
38
|
+
Pet = "pet",
|
|
39
|
+
Mount = "mount",
|
|
40
|
+
Backbling = "backbling"
|
|
41
|
+
}
|
|
42
|
+
export interface CosmeticResponseTypes {
|
|
43
|
+
[CosmeticType.Costume]: string;
|
|
44
|
+
[CosmeticType.Avatar]: {
|
|
45
|
+
name: string;
|
|
46
|
+
url: string;
|
|
47
|
+
};
|
|
48
|
+
[CosmeticType.HubTitle]: string;
|
|
49
|
+
[CosmeticType.Hat]: {
|
|
50
|
+
name: string;
|
|
51
|
+
icon: string;
|
|
52
|
+
rarity: string;
|
|
53
|
+
};
|
|
54
|
+
[CosmeticType.Pet]: string;
|
|
55
|
+
[CosmeticType.Mount]: string;
|
|
56
|
+
[CosmeticType.Backbling]: {
|
|
57
|
+
name: string;
|
|
58
|
+
icon: string;
|
|
59
|
+
rarity: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export default function processPlayerInfo(playerResponse: any): ProcessedPlayerResponse | null;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CosmeticType = void 0;
|
|
4
|
+
exports.default = processPlayerInfo;
|
|
5
|
+
var CosmeticType;
|
|
6
|
+
(function (CosmeticType) {
|
|
7
|
+
CosmeticType["Costume"] = "costume";
|
|
8
|
+
CosmeticType["Avatar"] = "avatar";
|
|
9
|
+
CosmeticType["HubTitle"] = "hub_title";
|
|
10
|
+
CosmeticType["Hat"] = "hat";
|
|
11
|
+
CosmeticType["Pet"] = "pet";
|
|
12
|
+
CosmeticType["Mount"] = "mount";
|
|
13
|
+
CosmeticType["Backbling"] = "backbling";
|
|
14
|
+
})(CosmeticType || (exports.CosmeticType = CosmeticType = {}));
|
|
15
|
+
function processPlayerInfo(playerResponse) {
|
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
17
|
+
if (!playerResponse)
|
|
18
|
+
return null;
|
|
19
|
+
var player = playerResponse.main;
|
|
20
|
+
var info = {
|
|
21
|
+
uuid: player.UUID,
|
|
22
|
+
xuid: player.xuid.toString(),
|
|
23
|
+
mcid: player.mcid,
|
|
24
|
+
username: player.username_cc,
|
|
25
|
+
rank: player.rank,
|
|
26
|
+
first_played: player.first_played,
|
|
27
|
+
login_streak: {
|
|
28
|
+
current: (_a = player.daily_login_streak) !== null && _a !== void 0 ? _a : 0,
|
|
29
|
+
longest: (_b = player.longest_daily_login_streak) !== null && _b !== void 0 ? _b : 0,
|
|
30
|
+
},
|
|
31
|
+
friend_count: (_c = player.friend_count) !== null && _c !== void 0 ? _c : 0,
|
|
32
|
+
quest_count: (_d = player.quest_count) !== null && _d !== void 0 ? _d : 0,
|
|
33
|
+
};
|
|
34
|
+
var equipped_cosmetics = {
|
|
35
|
+
costume: (_e = player.equipped_costume) !== null && _e !== void 0 ? _e : null,
|
|
36
|
+
avatar: (_f = player.equipped_avatar) !== null && _f !== void 0 ? _f : null,
|
|
37
|
+
hub_title: (_g = player.equipped_hub_title) !== null && _g !== void 0 ? _g : null,
|
|
38
|
+
hat: (_h = player.equipped_hat) !== null && _h !== void 0 ? _h : null,
|
|
39
|
+
backbling: (_j = player.equipped_backbling) !== null && _j !== void 0 ? _j : null,
|
|
40
|
+
};
|
|
41
|
+
var owned_cosmetics = {
|
|
42
|
+
costume: (_k = player.costume_unlocked) !== null && _k !== void 0 ? _k : [],
|
|
43
|
+
avatar: (_l = player.avatar_unlocked) !== null && _l !== void 0 ? _l : [],
|
|
44
|
+
hub_title: (_m = player.hub_title_unlocked) !== null && _m !== void 0 ? _m : [],
|
|
45
|
+
hat: (_o = player.hat_unlocked) !== null && _o !== void 0 ? _o : [],
|
|
46
|
+
pet: (_p = player.pets) !== null && _p !== void 0 ? _p : [],
|
|
47
|
+
mount: (_q = player.mounts) !== null && _q !== void 0 ? _q : [],
|
|
48
|
+
backbling: (_r = player["cosmetics.backbling"]) !== null && _r !== void 0 ? _r : [],
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
info: info,
|
|
52
|
+
equipped_cosmetics: equipped_cosmetics,
|
|
53
|
+
owned_cosmetics: owned_cosmetics,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = processPlayerSearch;
|
|
4
|
+
function processPlayerSearch(playerSearchResponse) {
|
|
5
|
+
if (!playerSearchResponse)
|
|
6
|
+
return null;
|
|
7
|
+
return playerSearchResponse.map(function (player) { return ({
|
|
8
|
+
uuid: player.UUID,
|
|
9
|
+
username: player.username_cc,
|
|
10
|
+
}); });
|
|
11
|
+
}
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface MethodResponseError {
|
|
2
|
+
status?: number;
|
|
3
|
+
message?: string;
|
|
4
|
+
}
|
|
5
|
+
export type MethodResponse<D extends any> = {
|
|
6
|
+
meta?: {
|
|
7
|
+
duration: number;
|
|
8
|
+
ratelimit?: {
|
|
9
|
+
limit: number;
|
|
10
|
+
remaining: number;
|
|
11
|
+
reset: number;
|
|
12
|
+
};
|
|
13
|
+
retryAfter?: number;
|
|
14
|
+
};
|
|
15
|
+
} & ({
|
|
16
|
+
data: D;
|
|
17
|
+
error: null;
|
|
18
|
+
} | {
|
|
19
|
+
data: null;
|
|
20
|
+
error: MethodResponseError;
|
|
21
|
+
});
|
package/lib/utils.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hive-bedrock-api",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "An API wrapper for the Hive Minecraft Bedrock Edition server.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"author": "Cubeedge Studios",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"hive-bedrock-data": "^4.0.
|
|
14
|
+
"hive-bedrock-data": "^4.0.1"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc"
|
|
@@ -22,5 +22,6 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"ts-node": "^10.9.1",
|
|
24
24
|
"typescript": "^5.1.3"
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"gitHead": "f865bf66484826cd8d60885b5d5fe94469278015"
|
|
26
27
|
}
|