hypixel-javascript is a new and powerful Hypixel Node.js module to interact with Hypixel.
- 100% coverage of the Hypixel API.
- Adapt inputs and methods and converts whenever possible.
- Helpful addons that reduce your workload.
- Ultra lightweight using minimal dependencies.
hypixel-javascript is a new module created by CactiveNetwork, you can get support on your code, report any issues and more by joining the discord at discord.gg/NeqVuSy.
In your project run npm install hypixel-javascript
.
Next enter the following in your main file (index.js
by default).
const Hypixel = require('hypixel-javascript');
const client = new Hypixel.Client("YOUR_API_KEY");
You need a Hypixel API key in order to use this library, join mc.hypixel.net and run /api new to get one.
const Hypixel = require('hypixel-javascript');
const client = new Hypixel.Client("YOUR_API_KEY"); // API Key
client.getPlayer('caykie') // Get player automatically
.then(console.log);
// or you can do;
(async () => {
const data = await client.getPlayer('caykie');
console.log(data.player);
})();
For this method, you can specify a username or UUID as the username will automatically convert to UUID, however being slightly slower. Different methods could be chosen, due to a change by Hypixel they have substantially limited the previous way of getting data through username directly.
// Slightly slower
client.getPlayer('caykie')
.then(console.log);
// Fastest way
client.getPlayer('eea2d4fd-a8b8-413b-9439-f06faaf7e109')
.then(console.log);
This is strongly not recommended as you will most likely need to cache data if you are fetching based on the username of the player. We strongly recommend using the data fetch above.
client.legacyGetPlayer('caykie')
.then(console.log);
client.legacyGetPlayer('eea2d4fd-a8b8-413b-9439-f06faaf7e109', 'uuid')
.then(console.log);
This method technically only supports UUIDs, and we do recommend using them. You can still supply a player username, however it will take slightly longer to fetch data from the Mojang API.
// Better to use
client.getFriends('eea2d4fd-a8b8-413b-9439-f06faaf7e109')
.then(console.log);
// Slightly slower
client.getFriends("caykie")
.then(console.log);
The player that you are requesting to get must have their recent games settings in the /settings menu on Hypixel enabled, otherwise you will not be able to see their recent games.
Again you can specify a username if you want, however we strongly recommend using a UUID if you can as it reduces wait time from additional requests.
// Better to use
client.getRecentGames('eea2d4fd-a8b8-413b-9439-f06faaf7e109')
.then(console.log);
// Slightly slower
client.getRecentGames('caykie')
.then(console.log);
If the player specified is online and they have the setting to show player status enabled in /settings on Hypixel, this information will show, it is on by default for all players except for staff.
Again you can specify a username if you want, however we strongly recommend using a UUID if you can as it reduces wait time from additional requests.
// Better to use
client.getStatus('eea2d4fd-a8b8-413b-9439-f06faaf7e109')
.then(console.log);
// Slightly slower
client.getStatus('caykie')
.then(console.log);
You MUST provide a method on the Guild, depending on if you do it by the ID, Guild Member or Name.
client.getGuild("CactiveNetwork", "name")
.then(console.log);
For this, you must specify a profile ID or player UUID to get multiple.
If you enter a username, it will still convert but slightly slower than normal.
client.getSkyBlockProfile("eea2d4fd-a8b8-413b-9439-f06faaf7e109", "uuid")
.then(console.log);
Specify a Player, Profile or UUID then provide a method of 'uuid', 'player', or 'profile'.
You can provide a username, as said before it is slightly slower than normal.
client.getSkyBlockAuctions("eea2d4fd-a8b8-413b-9439-f06faaf7e109", "uuid")
.then(console.log);
Optionally specify a page, defaulting to 0 and see the active SkyBlock auctions.
client.getActiveSkyBlockAuctions(0)
.then(console.log);
You can get the Player Count of all of Hypixel or just certain gamemodes.
client.getPlayerCounts
.then(console.log);
Get all of the different gamemode leaderboards.
client.getLeaderboards
.then(console.log);
Get total and recent punishment statistics by staff & watchdog.
client.getPunishmentStatistics
.then(console.log);
Get the currently active network boosters that apply to all players.
client.getActiveBoosters
.then(console.log);
Get a list of all the achievements and related information.
client.resourceAchievements
.then(console.log);
Get a list of all the challenges and related information.
client.resourceChallenges
.then(console.log);
Get a list of all the quests and related information.
client.resourceQuests
.then(console.log);
Get a list of all the guild achievements and related information.
client.resourceGuildAchievements
.then(console.log);
Get a list of all the guild permissions and related information.
client.resourceGuildPermissions
.then(console.log);
Get a list of all the SkyBlock collections and related information.
client.resourceSkyBlockCollections
.then(console.log);
Get a list of all the SkyBlock skills and related information.
client.resourceSkyBlockSkills
.then(console.log);
Get a list of the SkyBlock news pages on the forums for game updates and bug fixes.
client.getSkyBlockNews
.then(console.log);
Get a list of the ended SkyBlock auctions on the Hypixel Network.
client.getEndedSkyBlockAuctions
.then(console.log);
Get SkyBlock Bazaar information.
client.getSkyBlockBazaar
.then(console.log);
Sends a request to Mojang to get the Username and or UUID.
const log = console.log;
log(Hypixel.convertUser("eea2d4fd-a8b8-413b-9439-f06faaf7e109")); // caykie
// If you want to force something to be a UUID or Username do;
log(Hypixel.convertUser("eea2d4fd-a8b8-413b-9439-f06faaf7e109", "uuid")); // eea2d4fd-a8b8-413b-9439-f06faaf7e109
Does not send any requests and instantly adds dashes to a UUID if not done already.
const log = console.log;
log(Hypixel.fixUUID("eea2d4fda8b8413b9439f06faaf7e109")); // eea2d4fd-a8b8-413b-9439-f06faaf7e109
This will respond with either uuid
or name
.
const log = console.log;
log(Hypixel.getMethod("eea2d4fda8b8413b9439f06faaf7e109")); // uuid
log(Hypixel.getMethod("eea2d4fd-a8b8-413b-9439-f06faaf7e109")); // uuid
log(Hypixel.getMethod("caykie")); // name