Skip to content

A simple Javascript wrapper for the MCSRVSTAT tool - Fetch Minecraft Server Status with one line of code!

Notifications You must be signed in to change notification settings

azpha/mcsrvstat-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCSRVSTAT Simple Javascript Wrapper

I do not own MCSRVSTAT, this is simply a wrapper for their API :)

Easily fetch the status of a Minecraft server (Java or Bedrock) all from Node!

How do I use this?

You can utilize the following methods below.
If something is missing from these responses that are returned from MCSRVSTAT's API and you'd like to see them supported, create an issue!

fetchJavaServer

Fetch the status of a Minecraft Java server

const serverInfo = await fetchJavaServer('hostname.example.com');
console.log(serverInfo);
// { online: true, version: 'Requires MC 1.8 / 1.19', players: { online: 5, max: 20 }, connection: { ip: 'xxx.xxx.xxx.xxx', hostname: 'hostname.example.com' } }

fetchBedrockServer

Fetch the status of a Minecraft Bedrock server

const serverInfo = await fetchBedrockServer('hostname.example.com');
console.log(serverInfo);
// { online: true, version: 'x.xx.xx', players: { online: 5, max: 20 }, connection: { ip: 'xxx.xxx.xxx.xxx', hostname: 'hostname.example.com' } }

fetchIcon

Generates a link to the servers icon

let url = await mcsrvstat.fetchIcon('hostname.example.com');
console.log(url)
// 'https://api.mcsrvstat.us/icon/hostname.example.com'

getJavaHttp

Returns the status of a Minecraft Java server using HTTP status code conventions.
200 is expected for Online and 404 is expected for Offline.

const httpCode = await mcsrvstat.javaHttpCode('hostname.example.com');
console.log(httpCode);
// 200/404

getBedrockHttp

Returns the status of a Minecraft Bedrock server using HTTP status code conventions.
200 is expected for Online and 404 is expected for Offline.

const httpCode = await mcsrvstat.javaHttpCode('hostname.example.com');
console.log(httpCode);
// 200/404

About

A simple Javascript wrapper for the MCSRVSTAT tool - Fetch Minecraft Server Status with one line of code!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published