hypixel-api-reborn 9.0.3 → 11.0.0

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.
Files changed (105) hide show
  1. package/.prettierrc +13 -0
  2. package/README.md +28 -16
  3. package/package.json +60 -58
  4. package/src/API/getAPIStatus.js +8 -7
  5. package/src/API/getBoosters.js +6 -5
  6. package/src/API/getGameCounts.js +6 -5
  7. package/src/API/getGuild.js +18 -17
  8. package/src/API/getLeaderboards.js +13 -12
  9. package/src/API/getPlayer.js +22 -26
  10. package/src/API/getRecentGames.js +18 -17
  11. package/src/API/getServerInfo.js +66 -77
  12. package/src/API/getStatus.js +8 -7
  13. package/src/API/getWatchdogStats.js +6 -5
  14. package/src/API/index.js +19 -9
  15. package/src/API/skyblock/getEndedSkyblockAuctions.js +10 -9
  16. package/src/API/skyblock/getSkyblockAuctions.js +64 -64
  17. package/src/API/skyblock/getSkyblockAuctionsByPlayer.js +11 -10
  18. package/src/API/skyblock/getSkyblockBazaar.js +10 -9
  19. package/src/API/skyblock/getSkyblockMember.js +28 -24
  20. package/src/API/skyblock/getSkyblockNews.js +6 -5
  21. package/src/API/skyblock/getSkyblockProfiles.js +44 -40
  22. package/src/Client.js +406 -430
  23. package/src/Errors.js +44 -38
  24. package/src/Private/defaultCache.js +77 -0
  25. package/src/Private/rateLimit.js +79 -98
  26. package/src/Private/requests.js +65 -39
  27. package/src/Private/updater.js +45 -42
  28. package/src/Private/uuidCache.js +37 -33
  29. package/src/Private/validate.js +97 -97
  30. package/src/index.js +82 -83
  31. package/src/structures/APIIncident.js +78 -78
  32. package/src/structures/APIStatus.js +47 -47
  33. package/src/structures/Boosters/Booster.js +83 -87
  34. package/src/structures/Color.js +129 -129
  35. package/src/structures/Game.js +164 -160
  36. package/src/structures/GameCounts.js +151 -151
  37. package/src/structures/Guild/Guild.js +204 -218
  38. package/src/structures/Guild/GuildMember.js +66 -66
  39. package/src/structures/Guild/GuildRank.js +48 -48
  40. package/src/structures/ItemBytes.js +33 -36
  41. package/src/structures/Leaderboard.js +31 -31
  42. package/src/structures/MiniGames/Arcade.js +567 -569
  43. package/src/structures/MiniGames/ArenaBrawl.js +52 -56
  44. package/src/structures/MiniGames/BedWars.js +423 -329
  45. package/src/structures/MiniGames/BlitzSurvivalGames.js +172 -148
  46. package/src/structures/MiniGames/BuildBattle.js +53 -53
  47. package/src/structures/MiniGames/CopsAndCrims.js +90 -90
  48. package/src/structures/MiniGames/Duels.js +694 -460
  49. package/src/structures/MiniGames/MegaWalls.js +137 -137
  50. package/src/structures/MiniGames/MurderMystery.js +93 -93
  51. package/src/structures/MiniGames/Paintball.js +67 -67
  52. package/src/structures/MiniGames/Pit.js +19 -19
  53. package/src/structures/MiniGames/Quakecraft.js +101 -101
  54. package/src/structures/MiniGames/SkyWars.js +508 -559
  55. package/src/structures/MiniGames/SmashHeroes.js +144 -151
  56. package/src/structures/MiniGames/SpeedUHC.js +115 -57
  57. package/src/structures/MiniGames/TNTGames.js +116 -116
  58. package/src/structures/MiniGames/TurboKartRacers.js +201 -71
  59. package/src/structures/MiniGames/UHC.js +164 -143
  60. package/src/structures/MiniGames/VampireZ.js +60 -60
  61. package/src/structures/MiniGames/Walls.js +52 -52
  62. package/src/structures/MiniGames/Warlords.js +62 -62
  63. package/src/structures/MiniGames/WoolWars.js +123 -0
  64. package/src/structures/Pet.js +96 -97
  65. package/src/structures/Pets.js +64 -64
  66. package/src/structures/Player.js +433 -453
  67. package/src/structures/PlayerCosmetics.js +100 -95
  68. package/src/structures/RecentGame.js +57 -57
  69. package/src/structures/ServerInfo.js +78 -78
  70. package/src/structures/SkyBlock/Auctions/Auction.js +104 -104
  71. package/src/structures/SkyBlock/Auctions/AuctionInfo.js +54 -54
  72. package/src/structures/SkyBlock/Auctions/BaseAuction.js +45 -45
  73. package/src/structures/SkyBlock/Auctions/Bid.js +48 -48
  74. package/src/structures/SkyBlock/Auctions/PartialAuction.js +25 -25
  75. package/src/structures/SkyBlock/Bazzar/Order.js +38 -38
  76. package/src/structures/SkyBlock/Bazzar/Product.js +53 -53
  77. package/src/structures/SkyBlock/News/SkyblockNews.js +60 -68
  78. package/src/structures/SkyBlock/SkyblockInventoryItem.js +124 -102
  79. package/src/structures/SkyBlock/SkyblockMember.js +820 -675
  80. package/src/structures/SkyBlock/SkyblockPet.js +71 -71
  81. package/src/structures/SkyBlock/SkyblockProfile.js +60 -60
  82. package/src/structures/Status.js +41 -41
  83. package/src/structures/Watchdog/Stats.js +36 -36
  84. package/src/utils/Constants.js +2789 -795
  85. package/src/utils/SkyblockUtils.js +208 -164
  86. package/src/utils/arrayTools.js +4 -4
  87. package/src/utils/divide.js +5 -5
  88. package/src/utils/guildExp.js +57 -67
  89. package/src/utils/index.js +13 -9
  90. package/src/utils/isGuildID.js +3 -3
  91. package/src/utils/isUUID.js +5 -5
  92. package/src/utils/oscillation.js +15 -23
  93. package/src/utils/removeSnakeCase.js +22 -35
  94. package/src/utils/rgbToHexColor.js +8 -0
  95. package/src/utils/romanize.js +11 -0
  96. package/src/utils/toIGN.js +20 -20
  97. package/src/utils/toUuid.js +19 -19
  98. package/src/utils/varInt.js +17 -21
  99. package/typings/index.d.ts +3532 -2625
  100. package/src/API/getFriends.js +0 -13
  101. package/src/API/getKeyInfo.js +0 -9
  102. package/src/API/getRankedSkyWars.js +0 -10
  103. package/src/structures/Friend.js +0 -38
  104. package/src/structures/KeyInfo.js +0 -42
  105. package/src/structures/MiniGames/SkyWarsRanked.js +0 -45
@@ -1,13 +0,0 @@
1
- const Errors = require('../Errors');
2
- const toUuid = require('../utils/toUuid');
3
- module.exports = async function (query) {
4
- if (!query) throw new Error(Errors.NO_NICKNAME_UUID);
5
- const Friend = require('../structures/Friend');
6
- query = await toUuid(query);
7
- const res = await this._makeRequest(`/friends?uuid=${query}`);
8
- if (res.records.length && res.records.length > 0) {
9
- return res.records.map((f) => new Friend(f, query));
10
- } else {
11
- return [];
12
- }
13
- };
@@ -1,9 +0,0 @@
1
- const Errors = require('../Errors');
2
- module.exports = async function () {
3
- const KeyInfo = require('../structures/KeyInfo');
4
- const res = await this._makeRequest('/key');
5
- if (!res.success) {
6
- throw new Error(Errors.SOMETHING_WENT_WRONG.replace(/{cause}/, res.cause));
7
- }
8
- return new KeyInfo(res);
9
- };
@@ -1,10 +0,0 @@
1
- const Errors = require('../Errors');
2
- const toUuid = require('../utils/toUuid');
3
- module.exports = async function (query) {
4
- if (!query) throw new Error(Errors.NO_NICKNAME_UUID);
5
- const SkyWarsRanked = require('../structures/MiniGames/SkyWarsRanked');
6
- query = await toUuid(query);
7
- const res = await this._makeRequest(`/player/ranked/skywars?uuid=${query}`);
8
- if (!res.result) return null;
9
- return new SkyWarsRanked(res.result);
10
- };
@@ -1,38 +0,0 @@
1
- /**
2
- * Friend class
3
- */
4
- class Friend {
5
- /**
6
- * @param {object} data Friend data
7
- * @param {string} uuid UUID of player from whom the data is retrieved from
8
- */
9
- constructor (data, uuid) {
10
- /**
11
- * Friend request sender's UUID ( Whoever sent the FR ). This can be either the friend's or the player's uuid.
12
- * @type {string}
13
- */
14
- this.sender = data.uuidSender;
15
- /**
16
- * Friend request receiver's UUID ( Whoever received the FR ). This can be either the friend's or the player's uuid.
17
- * @type {string}
18
- */
19
- this.receiver = data.uuidReceiver;
20
- /**
21
- * Friend's UUID
22
- * @type {string}
23
- */
24
- this.uuid = this.sender === uuid ? this.receiver : this.sender;
25
- /**
26
- * Friend since timestamp
27
- * @type {number}
28
- */
29
- this.friendSinceTimestamp = data.started;
30
- /**
31
- * Friend since as Date
32
- * @type {Date}
33
- */
34
- this.friendSince = new Date(data.started);
35
- }
36
- }
37
-
38
- module.exports = Friend;
@@ -1,42 +0,0 @@
1
- /**
2
- * KeyInfo class
3
- */
4
- class KeyInfo {
5
- /**
6
- * @param {object} data Key data
7
- */
8
- constructor (data) {
9
- const record = data.record;
10
- /**
11
- * API key
12
- * @type {string}
13
- */
14
- this.key = record.key;
15
- /**
16
- * Key owner UUID
17
- * @type {string}
18
- */
19
- this.owner = record.owner;
20
- /**
21
- * Limit per minute
22
- * @type {number}
23
- */
24
- this.limitPerMinute = record.limit || 0;
25
- /**
26
- * Requests in past minute
27
- * @type {number}
28
- */
29
- this.requestsInPastMin = record.queriesInPastMin || 0;
30
- /**
31
- * Total requests
32
- * @type {number}
33
- */
34
- this.totalRequests = record.totalQueries || 0;
35
- /**
36
- * Limit resets after in seconds
37
- * @type {number}
38
- */
39
- this.resetsAfter = parseInt(data._headers.get('ratelimit-reset'), 10);
40
- }
41
- }
42
- module.exports = KeyInfo;
@@ -1,45 +0,0 @@
1
- /**
2
- * SkyWars Ranked class
3
- */
4
- class SkyWarsRanked {
5
- /**
6
- * @param {object} data
7
- */
8
- constructor (data) {
9
- /**
10
- * Ranked season key (e.g. 7_21 - July 2021)
11
- * @type {string}
12
- */
13
- this.seasonKey = data.key;
14
- /**
15
- * Current position
16
- * @type {number}
17
- */
18
- this.position = data.position;
19
- /**
20
- * Current rating
21
- * @type {number}
22
- */
23
- this.rating = data.score;
24
- /**
25
- * Season key parsed as date, should usually be current season
26
- * @type {Date}
27
- */
28
- this.date = getDateFromKey(this.seasonKey);
29
- }
30
- }
31
-
32
- /**
33
- * Gets date from season key
34
- * @param {string} key Season Key
35
- * @return {Date|null}
36
- */
37
- function getDateFromKey(key) {
38
- const initDate = new Date(1000 * 60 * 60 * 5);
39
- const [month, year] = key.split('_').map(Number);
40
- // month needs to be 0 indexed cuz js :)
41
- if (isNaN(month) || isNaN(year) || month > 11) return null;
42
- return new Date(initDate.setFullYear(2000 + year, month - 1, 1));
43
- }
44
-
45
- module.exports = SkyWarsRanked;