hypixel-api-reborn 10.0.0 → 11.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/.prettierrc +13 -0
- package/README.md +28 -16
- package/package.json +60 -58
- package/src/API/getAPIStatus.js +8 -8
- package/src/API/getBoosters.js +6 -6
- package/src/API/getGameCounts.js +6 -6
- package/src/API/getGuild.js +18 -18
- package/src/API/getLeaderboards.js +13 -13
- package/src/API/getPlayer.js +22 -27
- package/src/API/getRecentGames.js +18 -18
- package/src/API/getServerInfo.js +66 -77
- package/src/API/getStatus.js +8 -8
- package/src/API/getWatchdogStats.js +6 -6
- package/src/API/index.js +19 -23
- package/src/API/skyblock/getEndedSkyblockAuctions.js +10 -10
- package/src/API/skyblock/getSkyblockAuctions.js +64 -64
- package/src/API/skyblock/getSkyblockAuctionsByPlayer.js +11 -11
- package/src/API/skyblock/getSkyblockBazaar.js +10 -10
- package/src/API/skyblock/getSkyblockMember.js +28 -25
- package/src/API/skyblock/getSkyblockNews.js +6 -6
- package/src/API/skyblock/getSkyblockProfiles.js +44 -41
- package/src/Client.js +406 -450
- package/src/Errors.js +44 -39
- package/src/Private/defaultCache.js +77 -78
- package/src/Private/rateLimit.js +79 -98
- package/src/Private/requests.js +65 -54
- package/src/Private/updater.js +45 -45
- package/src/Private/uuidCache.js +37 -33
- package/src/Private/validate.js +97 -97
- package/src/index.js +82 -83
- package/src/structures/APIIncident.js +78 -78
- package/src/structures/APIStatus.js +47 -47
- package/src/structures/Boosters/Booster.js +83 -87
- package/src/structures/Color.js +129 -129
- package/src/structures/Game.js +164 -160
- package/src/structures/GameCounts.js +151 -151
- package/src/structures/Guild/Guild.js +204 -218
- package/src/structures/Guild/GuildMember.js +66 -66
- package/src/structures/Guild/GuildRank.js +48 -48
- package/src/structures/ItemBytes.js +33 -36
- package/src/structures/Leaderboard.js +31 -31
- package/src/structures/MiniGames/Arcade.js +567 -569
- package/src/structures/MiniGames/ArenaBrawl.js +52 -56
- package/src/structures/MiniGames/BedWars.js +423 -351
- package/src/structures/MiniGames/BlitzSurvivalGames.js +172 -148
- package/src/structures/MiniGames/BuildBattle.js +53 -53
- package/src/structures/MiniGames/CopsAndCrims.js +90 -90
- package/src/structures/MiniGames/Duels.js +694 -630
- package/src/structures/MiniGames/MegaWalls.js +137 -137
- package/src/structures/MiniGames/MurderMystery.js +93 -93
- package/src/structures/MiniGames/Paintball.js +67 -67
- package/src/structures/MiniGames/Pit.js +19 -19
- package/src/structures/MiniGames/Quakecraft.js +101 -101
- package/src/structures/MiniGames/SkyWars.js +508 -559
- package/src/structures/MiniGames/SmashHeroes.js +144 -151
- package/src/structures/MiniGames/SpeedUHC.js +115 -57
- package/src/structures/MiniGames/TNTGames.js +116 -116
- package/src/structures/MiniGames/TurboKartRacers.js +201 -176
- package/src/structures/MiniGames/UHC.js +164 -143
- package/src/structures/MiniGames/VampireZ.js +60 -60
- package/src/structures/MiniGames/Walls.js +52 -52
- package/src/structures/MiniGames/Warlords.js +62 -62
- package/src/structures/MiniGames/WoolWars.js +123 -0
- package/src/structures/Pet.js +96 -97
- package/src/structures/Pets.js +64 -64
- package/src/structures/Player.js +433 -449
- package/src/structures/PlayerCosmetics.js +100 -95
- package/src/structures/RecentGame.js +57 -57
- package/src/structures/ServerInfo.js +78 -78
- package/src/structures/SkyBlock/Auctions/Auction.js +104 -104
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +54 -54
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +45 -45
- package/src/structures/SkyBlock/Auctions/Bid.js +48 -48
- package/src/structures/SkyBlock/Auctions/PartialAuction.js +25 -25
- package/src/structures/SkyBlock/Bazzar/Order.js +38 -38
- package/src/structures/SkyBlock/Bazzar/Product.js +53 -53
- package/src/structures/SkyBlock/News/SkyblockNews.js +60 -68
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +124 -130
- package/src/structures/SkyBlock/SkyblockMember.js +820 -687
- package/src/structures/SkyBlock/SkyblockPet.js +71 -71
- package/src/structures/SkyBlock/SkyblockProfile.js +60 -60
- package/src/structures/Status.js +41 -41
- package/src/structures/Watchdog/Stats.js +36 -36
- package/src/utils/Constants.js +2789 -809
- package/src/utils/SkyblockUtils.js +208 -164
- package/src/utils/arrayTools.js +4 -4
- package/src/utils/divide.js +5 -5
- package/src/utils/guildExp.js +57 -67
- package/src/utils/index.js +13 -13
- package/src/utils/isGuildID.js +3 -3
- package/src/utils/isUUID.js +5 -5
- package/src/utils/oscillation.js +15 -23
- package/src/utils/removeSnakeCase.js +22 -35
- package/src/utils/rgbToHexColor.js +8 -8
- package/src/utils/romanize.js +11 -13
- package/src/utils/toIGN.js +20 -20
- package/src/utils/toUuid.js +19 -19
- package/src/utils/varInt.js +17 -21
- package/typings/index.d.ts +3532 -2644
- package/src/API/getFriends.js +0 -14
- package/src/API/getKeyInfo.js +0 -10
- package/src/API/getRankedSkyWars.js +0 -11
- package/src/structures/Friend.js +0 -38
- package/src/structures/KeyInfo.js +0 -42
- package/src/structures/MiniGames/SkyWarsRanked.js +0 -45
|
@@ -1,35 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* @param {string} str
|
|
24
|
-
* @return {string}
|
|
25
|
-
*/
|
|
26
|
-
function removeSnakeCaseString (str) {
|
|
27
|
-
if (typeof str !== 'string') return null;
|
|
28
|
-
return str.toLowerCase().replace(/_[a-z]/gi, (x) => x[1].toUpperCase());
|
|
29
|
-
}
|
|
30
|
-
module.exports = {
|
|
31
|
-
single,
|
|
32
|
-
recursive,
|
|
33
|
-
validateJSON,
|
|
34
|
-
removeSnakeCaseString
|
|
35
|
-
};
|
|
1
|
+
// eslint-disable-next-line require-jsdoc
|
|
2
|
+
const single = (obj) => Object.keys(obj).reduce((pV, cV) => ({ ...pV, [cV.replace(/_[a-z]/gi, (x) => x[1].toUpperCase())]: obj[cV] }), {});
|
|
3
|
+
// eslint-disable-next-line require-jsdoc
|
|
4
|
+
function validateJSON(obj) {
|
|
5
|
+
return typeof obj === 'object' && JSON.stringify(obj)[0] === '{';
|
|
6
|
+
}
|
|
7
|
+
// eslint-disable-next-line require-jsdoc
|
|
8
|
+
function recursive(obj, lowerCase = false) {
|
|
9
|
+
if (!validateJSON(obj)) return obj;
|
|
10
|
+
return Object.keys(obj).reduce((pV, cV) => ({ ...pV, [(lowerCase ? cV : cV.toLowerCase()).replace(/_[a-z]/gi, (x) => x[1].toUpperCase())]: recursive(obj[cV]) }), {});
|
|
11
|
+
}
|
|
12
|
+
// eslint-disable-next-line require-jsdoc
|
|
13
|
+
function removeSnakeCaseString(str) {
|
|
14
|
+
if (typeof str !== 'string') return null;
|
|
15
|
+
return str.toLowerCase().replace(/_[a-z]/gi, (x) => x[1].toUpperCase());
|
|
16
|
+
}
|
|
17
|
+
module.exports = {
|
|
18
|
+
single,
|
|
19
|
+
recursive,
|
|
20
|
+
validateJSON,
|
|
21
|
+
removeSnakeCaseString
|
|
22
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
module.exports = (rgb) => {
|
|
2
|
-
let hexCode = '#';
|
|
3
|
-
for (const num of rgb) {
|
|
4
|
-
const hex = Number(num).toString(16);
|
|
5
|
-
hexCode +=
|
|
6
|
-
}
|
|
7
|
-
return hexCode;
|
|
8
|
-
};
|
|
1
|
+
module.exports = (rgb) => {
|
|
2
|
+
let hexCode = '#';
|
|
3
|
+
for (const num of rgb) {
|
|
4
|
+
const hex = Number(num).toString(16);
|
|
5
|
+
hexCode += hex.length === 1 ? '0' + hex : hex;
|
|
6
|
+
}
|
|
7
|
+
return hexCode;
|
|
8
|
+
};
|
package/src/utils/romanize.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
module.exports = (num) => {
|
|
2
|
-
if (isNaN(num)) return NaN;
|
|
3
|
-
const digits = String(+num).split('');
|
|
4
|
-
const key = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM',
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return Array(+digits.join('') + 1).join('M') + roman;
|
|
13
|
-
};
|
|
1
|
+
module.exports = (num) => {
|
|
2
|
+
if (isNaN(num)) return NaN;
|
|
3
|
+
const digits = String(+num).split('');
|
|
4
|
+
const key = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'];
|
|
5
|
+
let roman = '';
|
|
6
|
+
let i = 3;
|
|
7
|
+
while (i--) {
|
|
8
|
+
roman = (key[+digits.pop() + i * 10] || '') + roman;
|
|
9
|
+
}
|
|
10
|
+
return Array(+digits.join('') + 1).join('M') + roman;
|
|
11
|
+
};
|
package/src/utils/toIGN.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
const fetch = require('../Private/uuidCache.js');
|
|
2
|
-
const isUUID = require('./isUUID.js');
|
|
3
|
-
const Errors = require('../Errors');
|
|
4
|
-
|
|
5
|
-
module.exports = async (input) => {
|
|
6
|
-
if (!input) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
7
|
-
if (typeof input !== 'string') throw new Error(Errors.UUID_NICKNAME_MUST_BE_A_STRING);
|
|
8
|
-
if (isUUID(input)) input = input.replace(/-/g, '');
|
|
9
|
-
else throw new Error(Errors.MALFORMED_UUID);
|
|
10
|
-
try {
|
|
11
|
-
const res = await fetch(`https://sessionserver.mojang.com/session/minecraft/profile/${input}`, input);
|
|
12
|
-
const parsedRes = await res.json();
|
|
13
|
-
if (parsedRes.error) {
|
|
14
|
-
return Promise.reject(new Error(Errors.MALFORMED_UUID));
|
|
15
|
-
}
|
|
16
|
-
return parsedRes.name;
|
|
17
|
-
} catch {
|
|
18
|
-
throw new Error(Errors.PLAYER_DOES_NOT_EXIST);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
1
|
+
const fetch = require('../Private/uuidCache.js');
|
|
2
|
+
const isUUID = require('./isUUID.js');
|
|
3
|
+
const Errors = require('../Errors');
|
|
4
|
+
|
|
5
|
+
module.exports = async (input) => {
|
|
6
|
+
if (!input) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
7
|
+
if (typeof input !== 'string') throw new Error(Errors.UUID_NICKNAME_MUST_BE_A_STRING);
|
|
8
|
+
if (isUUID(input)) input = input.replace(/-/g, '');
|
|
9
|
+
else throw new Error(Errors.MALFORMED_UUID);
|
|
10
|
+
try {
|
|
11
|
+
const res = await fetch(`https://sessionserver.mojang.com/session/minecraft/profile/${input}`, input);
|
|
12
|
+
const parsedRes = await res.json();
|
|
13
|
+
if (parsedRes.error) {
|
|
14
|
+
return Promise.reject(new Error(Errors.MALFORMED_UUID));
|
|
15
|
+
}
|
|
16
|
+
return parsedRes.name;
|
|
17
|
+
} catch {
|
|
18
|
+
throw new Error(Errors.PLAYER_DOES_NOT_EXIST);
|
|
19
|
+
}
|
|
20
|
+
};
|
package/src/utils/toUuid.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const fetch = require('../Private/uuidCache');
|
|
2
|
-
const isUUID = require('./isUUID.js');
|
|
3
|
-
const Errors = require('../Errors');
|
|
4
|
-
|
|
5
|
-
module.exports = async (input) => {
|
|
6
|
-
if (!input) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
7
|
-
if (typeof input !== 'string') throw new Error(Errors.UUID_NICKNAME_MUST_BE_A_STRING);
|
|
8
|
-
if (isUUID(input)) return input.replace(/-/g, '');
|
|
9
|
-
try {
|
|
10
|
-
const res = await fetch(`https://api.mojang.com/users/profiles/minecraft/${input}`, input);
|
|
11
|
-
const parsedRes = await res.json();
|
|
12
|
-
if (
|
|
13
|
-
return Promise.reject(new Error(Errors.
|
|
14
|
-
}
|
|
15
|
-
return parsedRes.id;
|
|
16
|
-
} catch {
|
|
17
|
-
throw new Error(Errors.PLAYER_DOES_NOT_EXIST);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
1
|
+
const fetch = require('../Private/uuidCache');
|
|
2
|
+
const isUUID = require('./isUUID.js');
|
|
3
|
+
const Errors = require('../Errors');
|
|
4
|
+
|
|
5
|
+
module.exports = async (input) => {
|
|
6
|
+
if (!input) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
7
|
+
if (typeof input !== 'string') throw new Error(Errors.UUID_NICKNAME_MUST_BE_A_STRING);
|
|
8
|
+
if (isUUID(input)) return input.replace(/-/g, '');
|
|
9
|
+
try {
|
|
10
|
+
const res = await fetch(`https://api.mojang.com/users/profiles/minecraft/${input}`, input);
|
|
11
|
+
const parsedRes = await res.json();
|
|
12
|
+
if (res.status === 404) {
|
|
13
|
+
return Promise.reject(new Error(Errors.PLAYER_DOES_NOT_EXIST));
|
|
14
|
+
}
|
|
15
|
+
return parsedRes.id;
|
|
16
|
+
} catch {
|
|
17
|
+
throw new Error(Errors.PLAYER_DOES_NOT_EXIST);
|
|
18
|
+
}
|
|
19
|
+
};
|
package/src/utils/varInt.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
module.exports = readVarInt;
|
|
1
|
+
// eslint-disable-next-line require-jsdoc
|
|
2
|
+
function readVarInt(bytes) {
|
|
3
|
+
let numRead = 0;
|
|
4
|
+
let result = 0;
|
|
5
|
+
do {
|
|
6
|
+
const read = bytes[numRead];
|
|
7
|
+
const value = read & 0b01111111;
|
|
8
|
+
result |= value << (7 * numRead);
|
|
9
|
+
numRead++;
|
|
10
|
+
if (numRead > 5) {
|
|
11
|
+
return NaN;
|
|
12
|
+
}
|
|
13
|
+
} while (numRead < bytes.length);
|
|
14
|
+
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
module.exports = readVarInt;
|