我的世界服务器信息查询api,Minecraft API

All requests should be sent to /server/status or /server/query.

You may add two parameters, an ip and a port.

JSONP is not supported as CORS is enabled.

Please do not send more than one request per client per minute as data is cached server side for one

minute.

An example request would look like https://mcapi.us/server/status?ip=s.nerd.nu. If you

are

using a non-standard 25565 port, you may include the port too, like this:

https://mcapi.us/server/status?ip=s.nerd.nu&port=25565.

Alternatively, you can use our JavaScript library. Here's a small example of it in use.

My awesome server is currently !

MinecraftAPI.getServerStatus('s.nerd.nu', {

port: 25565 // optional, only if you need a custom port

}, function (err, status) {

if (err) {

return document.querySelector('.server-status').innerHTML = 'Error loading status';

}

// you can change these to your own message!

document.querySelector('.server-online').innerHTML = status.online ? 'up' : 'down';

});

A response from this might look the following (live response data):

name

description

example

status

the status of the request, typically success unless a poor request is made or my

server is

having internal troubles. if this is not success, assume the data is bad and should

not be used.

success

online

if the server is online or not

true

motd

the server description, also known as the message of the day. some strange

formatting may be in

this, there are various libraries available for formatting this.

My Minecraft server

error

error message from the request. if you forget the IP the error will be

missing data.

if it is an invalid IP, the error will be invalid hostname or port. if

an error

starts with internal server error, it means something is wrong with my

server.

empty means no error.

players.max

number of players that the server will allow

20

players.now

number of players currently online

2

server.name

current server version name

Spigot 1.8.3

server.protocol

server version protocol

47

last_online

the date the server was last recorded online. if empty, it has never been online. it

is a unix

timestamp in string form. if this has the same value as last_updated,

it means that

it is currently online.

1431985691

last_updated

the date the status of the server was last updated at. it updates every five

minutes, so you may

send requests as soon as it has expired.

1431985691

duration

the time it took to process the original request, in nanoseconds.

143439400

If you're looking for more information about the server, such as what plugins are installed or the

name

of the players currently online, you can try the /server/query endpoint instead. It

takes

the same parameters, and can be used with the provided JavaScript library by calling

MinecraftAPI.getServerQuery instead.

However, query must be enabled on the server for this to work.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值